@@ -60,6 +60,12 @@ command will perform an upgrade if needed.`,
6060
6161 # Run bootstrap for a Git repository with a private key and password
6262 flux bootstrap git --url=ssh://[email protected] /repository.git --private-key-file=<path/to/private.key> --password=<password> 63+
64+ # Run bootstrap for a Git repository on AWS CodeCommit
65+ flux bootstrap git --url=ssh://<SSH-Key-ID>@git-codecommit.<region>.amazonaws.com/v1/repos/<repository> --private-key-file=<path/to/private.key> --password=<SSH-passphrase>
66+
67+ # Run bootstrap for a Git repository on Azure Devops
68+ flux bootstrap git --url=ssh://[email protected] /v3/<org>/<project>/<repository> --ssh-key-algorithm=rsa --ssh-rsa-bits=4096 6369` ,
6470 RunE : bootstrapGitCmdRun ,
6571}
@@ -115,6 +121,23 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
115121 return err
116122 }
117123
124+ if strings .Contains (repositoryURL .Hostname (), "git-codecommit" ) && strings .Contains (repositoryURL .Hostname (), "amazonaws.com" ) {
125+ if repositoryURL .Scheme == git .SSH {
126+ if repositoryURL .User == nil {
127+ return fmt .Errorf ("invalid AWS CodeCommit url: ssh username should be specified in the url" )
128+ }
129+ if repositoryURL .User .Username () == git .DefaultPublicKeyAuthUser {
130+ return fmt .Errorf ("invalid AWS CodeCommit url: ssh username should be the SSH key ID for the provided private key" )
131+ }
132+ if bootstrapArgs .privateKeyFile == "" {
133+ return fmt .Errorf ("private key file is required for bootstrapping against AWS CodeCommit using ssh" )
134+ }
135+ }
136+ if repositoryURL .Scheme == git .HTTPS && ! bootstrapArgs .tokenAuth {
137+ return fmt .Errorf ("--token-auth=true must be specified for using a HTTPS AWS CodeCommit url" )
138+ }
139+ }
140+
118141 ctx , cancel := context .WithTimeout (context .Background (), rootArgs .timeout )
119142 defer cancel ()
120143
@@ -154,7 +177,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
154177 }
155178
156179 clientOpts := []gogit.ClientOption {gogit .WithDiskStorage ()}
157- if authOpts . Transport == git . HTTP {
180+ if gitArgs . insecureHttpAllowed {
158181 clientOpts = append (clientOpts , gogit .WithInsecureCredentialsOverHTTP ())
159182 }
160183 gitClient , err := gogit .NewClient (tmpDir , authOpts , clientOpts ... )
0 commit comments