diff --git a/cmd/flux/bootstrap.go b/cmd/flux/bootstrap.go index e7dbaf4e..49cd88d8 100644 --- a/cmd/flux/bootstrap.go +++ b/cmd/flux/bootstrap.go @@ -47,6 +47,7 @@ type bootstrapFlags struct { branch string recurseSubmodules bool + sparseCheckout []string manifestsPath string defaultComponents []string @@ -109,6 +110,8 @@ func init() { bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.branch, "branch", bootstrapDefaultBranch, "Git branch") bootstrapCmd.PersistentFlags().BoolVar(&bootstrapArgs.recurseSubmodules, "recurse-submodules", false, "when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces") + bootstrapCmd.PersistentFlags().StringSliceVar(&bootstrapArgs.sparseCheckout, "sparse-checkout", nil, + "list of directories to be included in the GitRepository sparse checkout, the configured --path must be one of them, accepts comma-separated values") bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.manifestsPath, "manifests", "", "path to the manifest directory") diff --git a/cmd/flux/bootstrap_bitbucket_server.go b/cmd/flux/bootstrap_bitbucket_server.go index 3490ffbe..7cbfce73 100644 --- a/cmd/flux/bootstrap_bitbucket_server.go +++ b/cmd/flux/bootstrap_bitbucket_server.go @@ -253,6 +253,7 @@ func bootstrapBServerCmdRun(cmd *cobra.Command, args []string) error { TargetPath: bServerArgs.path.ToSlash(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, RecurseSubmodules: bootstrapArgs.recurseSubmodules, + SparseCheckout: bootstrapArgs.sparseCheckout, } entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) diff --git a/cmd/flux/bootstrap_git.go b/cmd/flux/bootstrap_git.go index fa3a4774..52b67723 100644 --- a/cmd/flux/bootstrap_git.go +++ b/cmd/flux/bootstrap_git.go @@ -311,6 +311,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error { TargetPath: gitArgs.path.ToSlash(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, RecurseSubmodules: bootstrapArgs.recurseSubmodules, + SparseCheckout: bootstrapArgs.sparseCheckout, } if gitProvider != "" { syncOpts.Provider = gitProvider diff --git a/cmd/flux/bootstrap_gitea.go b/cmd/flux/bootstrap_gitea.go index c6db27f8..81a2d544 100644 --- a/cmd/flux/bootstrap_gitea.go +++ b/cmd/flux/bootstrap_gitea.go @@ -232,6 +232,7 @@ func bootstrapGiteaCmdRun(cmd *cobra.Command, args []string) error { TargetPath: giteaArgs.path.ToSlash(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, RecurseSubmodules: bootstrapArgs.recurseSubmodules, + SparseCheckout: bootstrapArgs.sparseCheckout, } entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) diff --git a/cmd/flux/bootstrap_github.go b/cmd/flux/bootstrap_github.go index 9c5ca2a2..a0c5974e 100644 --- a/cmd/flux/bootstrap_github.go +++ b/cmd/flux/bootstrap_github.go @@ -239,6 +239,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error { TargetPath: githubArgs.path.ToSlash(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, RecurseSubmodules: bootstrapArgs.recurseSubmodules, + SparseCheckout: bootstrapArgs.sparseCheckout, } entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) diff --git a/cmd/flux/bootstrap_gitlab.go b/cmd/flux/bootstrap_gitlab.go index 9f4510ca..c1a16902 100644 --- a/cmd/flux/bootstrap_gitlab.go +++ b/cmd/flux/bootstrap_gitlab.go @@ -287,6 +287,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error { TargetPath: gitlabArgs.path.ToSlash(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, RecurseSubmodules: bootstrapArgs.recurseSubmodules, + SparseCheckout: bootstrapArgs.sparseCheckout, } entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) diff --git a/pkg/manifestgen/sync/options.go b/pkg/manifestgen/sync/options.go index cab51037..862afe85 100644 --- a/pkg/manifestgen/sync/options.go +++ b/pkg/manifestgen/sync/options.go @@ -34,6 +34,7 @@ type Options struct { ManifestFile string RecurseSubmodules bool Provider string + SparseCheckout []string } func MakeDefaultOptions() Options { diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go index 526ebfc1..3e89ba3e 100644 --- a/pkg/manifestgen/sync/sync.go +++ b/pkg/manifestgen/sync/sync.go @@ -69,6 +69,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) { }, RecurseSubmodules: options.RecurseSubmodules, Provider: options.Provider, + SparseCheckout: options.SparseCheckout, }, }