Add recurse submodules arg to create source git cmd

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
pull/1191/head
Stefan Prodan 4 years ago
parent 8f0cd35d7a
commit 18c3f79319
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF

@ -188,7 +188,8 @@ jobs:
run: |
/tmp/flux create source git flux-system \
--url=https://github.com/fluxcd/flux2-kustomize-helm-example \
--branch=main
--branch=main \
--recurse-submodules
/tmp/flux create kustomization flux-system \
--source=flux-system \
--path=./clusters/staging

@ -56,6 +56,7 @@ type sourceGitFlags struct {
gitImplementation flags.GitImplementation
caFile string
privateKeyFile string
recurseSubmodules bool
}
var createSourceGitCmd = &cobra.Command{
@ -124,6 +125,7 @@ func init() {
createSourceGitCmd.Flags().Var(&sourceGitArgs.gitImplementation, "git-implementation", sourceGitArgs.gitImplementation.Description())
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.caFile, "ca-file", "", "path to TLS CA file used for validating self-signed certificates")
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.privateKeyFile, "private-key-file", "", "path to a passwordless private key file used for authenticating to the Git SSH server")
createSourceGitCmd.Flags().BoolVar(&sourceGitArgs.recurseSubmodules, "recurse-submodules", false, "when enabled, after the clone is created, initializes all Git submodules within")
createSourceCmd.AddCommand(createSourceGitCmd)
}
@ -158,6 +160,10 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("specifing a CA file is not supported for Git over SSH")
}
if sourceGitArgs.recurseSubmodules && sourceGitArgs.gitImplementation == sourcev1.LibGit2Implementation {
return fmt.Errorf("recurse submodules requires --git-implementation=%s", sourcev1.GoGitImplementation)
}
tmpDir, err := ioutil.TempDir("", name)
if err != nil {
return err
@ -180,7 +186,8 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
Interval: metav1.Duration{
Duration: createArgs.interval,
},
Reference: &sourcev1.GitRepositoryRef{},
RecurseSubmodules: sourceGitArgs.recurseSubmodules,
Reference: &sourcev1.GitRepositoryRef{},
},
}

@ -70,6 +70,7 @@ flux create source git [name] [flags]
-h, --help help for git
-p, --password string basic authentication password
--private-key-file string path to a passwordless private key file used for authenticating to the Git SSH server
--recurse-submodules when enabled, after the clone is created, initializes all Git submodules within
--secret-ref string the name of an existing secret containing SSH or basic credentials
--ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384)
--ssh-key-algorithm publicKeyAlgorithm SSH public key algorithm (rsa, ecdsa, ed25519) (default rsa)

Loading…
Cancel
Save