1
0
mirror of synced 2026-06-19 03:40:49 +00:00

Support specifing sparseCheckout in flux bootstrap

Signed-off-by: piny940 <83708535+piny940@users.noreply.github.com>
Assisted-by: claude/opus-4.7
This commit is contained in:
piny940
2026-05-29 13:28:30 +09:00
parent c438a10efc
commit 56166fd90c
8 changed files with 10 additions and 0 deletions
+3
View File
@@ -47,6 +47,7 @@ type bootstrapFlags struct {
branch string branch string
recurseSubmodules bool recurseSubmodules bool
sparseCheckout []string
manifestsPath string manifestsPath string
defaultComponents []string defaultComponents []string
@@ -109,6 +110,8 @@ func init() {
bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.branch, "branch", bootstrapDefaultBranch, "Git branch") bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.branch, "branch", bootstrapDefaultBranch, "Git branch")
bootstrapCmd.PersistentFlags().BoolVar(&bootstrapArgs.recurseSubmodules, "recurse-submodules", false, 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") "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") bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.manifestsPath, "manifests", "", "path to the manifest directory")
+1
View File
@@ -253,6 +253,7 @@ func bootstrapBServerCmdRun(cmd *cobra.Command, args []string) error {
TargetPath: bServerArgs.path.ToSlash(), TargetPath: bServerArgs.path.ToSlash(),
ManifestFile: sync.MakeDefaultOptions().ManifestFile, ManifestFile: sync.MakeDefaultOptions().ManifestFile,
RecurseSubmodules: bootstrapArgs.recurseSubmodules, RecurseSubmodules: bootstrapArgs.recurseSubmodules,
SparseCheckout: bootstrapArgs.sparseCheckout,
} }
entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath)
+1
View File
@@ -311,6 +311,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error {
TargetPath: gitArgs.path.ToSlash(), TargetPath: gitArgs.path.ToSlash(),
ManifestFile: sync.MakeDefaultOptions().ManifestFile, ManifestFile: sync.MakeDefaultOptions().ManifestFile,
RecurseSubmodules: bootstrapArgs.recurseSubmodules, RecurseSubmodules: bootstrapArgs.recurseSubmodules,
SparseCheckout: bootstrapArgs.sparseCheckout,
} }
if gitProvider != "" { if gitProvider != "" {
syncOpts.Provider = gitProvider syncOpts.Provider = gitProvider
+1
View File
@@ -232,6 +232,7 @@ func bootstrapGiteaCmdRun(cmd *cobra.Command, args []string) error {
TargetPath: giteaArgs.path.ToSlash(), TargetPath: giteaArgs.path.ToSlash(),
ManifestFile: sync.MakeDefaultOptions().ManifestFile, ManifestFile: sync.MakeDefaultOptions().ManifestFile,
RecurseSubmodules: bootstrapArgs.recurseSubmodules, RecurseSubmodules: bootstrapArgs.recurseSubmodules,
SparseCheckout: bootstrapArgs.sparseCheckout,
} }
entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath)
+1
View File
@@ -239,6 +239,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
TargetPath: githubArgs.path.ToSlash(), TargetPath: githubArgs.path.ToSlash(),
ManifestFile: sync.MakeDefaultOptions().ManifestFile, ManifestFile: sync.MakeDefaultOptions().ManifestFile,
RecurseSubmodules: bootstrapArgs.recurseSubmodules, RecurseSubmodules: bootstrapArgs.recurseSubmodules,
SparseCheckout: bootstrapArgs.sparseCheckout,
} }
entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath)
+1
View File
@@ -287,6 +287,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
TargetPath: gitlabArgs.path.ToSlash(), TargetPath: gitlabArgs.path.ToSlash(),
ManifestFile: sync.MakeDefaultOptions().ManifestFile, ManifestFile: sync.MakeDefaultOptions().ManifestFile,
RecurseSubmodules: bootstrapArgs.recurseSubmodules, RecurseSubmodules: bootstrapArgs.recurseSubmodules,
SparseCheckout: bootstrapArgs.sparseCheckout,
} }
entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath) entityList, err := bootstrap.LoadEntityListFromPath(bootstrapArgs.gpgKeyRingPath)
+1
View File
@@ -34,6 +34,7 @@ type Options struct {
ManifestFile string ManifestFile string
RecurseSubmodules bool RecurseSubmodules bool
Provider string Provider string
SparseCheckout []string
} }
func MakeDefaultOptions() Options { func MakeDefaultOptions() Options {
+1
View File
@@ -69,6 +69,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) {
}, },
RecurseSubmodules: options.RecurseSubmodules, RecurseSubmodules: options.RecurseSubmodules,
Provider: options.Provider, Provider: options.Provider,
SparseCheckout: options.SparseCheckout,
}, },
} }