You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add tmpdir command flag and refactor CommonOptions (zarf-dev#600)
* Add tmpdir command flag and refactor CommonOptions
* Add docs for tmpdir command flag
* Add tests for package create, inspect and deploy with --tmpdir
* Refactor package deploy test for --tmpdir
* Simplify test for --tmpdir in package deploy
Copy file name to clipboardexpand all lines: src/cmd/package.go
+6-3
Original file line number
Diff line number
Diff line change
@@ -108,16 +108,19 @@ func init() {
108
108
packageCmd.AddCommand(packageDeployCmd)
109
109
packageCmd.AddCommand(packageInspectCmd)
110
110
111
-
packageCreateCmd.Flags().BoolVar(&config.DeployOptions.Confirm, "confirm", false, "Confirm package creation without prompting")
111
+
packageCreateCmd.Flags().BoolVar(&config.CommonOptions.Confirm, "confirm", false, "Confirm package creation without prompting")
112
+
packageCreateCmd.Flags().StringVar(&config.CommonOptions.TempDirectory, "tmpdir", "", "Specify the temporary directory to use for intermediate files")
112
113
packageCreateCmd.Flags().StringVar(&zarfImageCache, "zarf-cache", config.ZarfDefaultImageCachePath, "Specify the location of the Zarf image cache")
113
114
packageCreateCmd.Flags().StringVarP(&config.CreateOptions.OutputDirectory, "output-directory", "o", "", "Specify the output directory for the created Zarf package")
114
115
packageCreateCmd.Flags().BoolVar(&config.CreateOptions.SkipSBOM, "skip-sbom", false, "Skip generating SBOM for this package")
packageDeployCmd.Flags().BoolVar(&config.DeployOptions.Confirm, "confirm", false, "Confirm package deployment without prompting")
118
+
packageDeployCmd.Flags().BoolVar(&config.CommonOptions.Confirm, "confirm", false, "Confirm package deployment without prompting")
119
+
packageDeployCmd.Flags().StringVar(&config.CommonOptions.TempDirectory, "tmpdir", "", "Specify the temporary directory to use for intermediate files")
118
120
packageDeployCmd.Flags().StringVar(&config.DeployOptions.Components, "components", "", "Comma-separated list of components to install. Adding this flag will skip the init prompts for which components to install")
119
121
packageDeployCmd.Flags().BoolVar(&insecureDeploy, "insecure", false, "Skip shasum validation of remote package. Required if deploying a remote package and `--shasum` is not provided")
120
122
packageDeployCmd.Flags().StringVar(&shasum, "shasum", "", "Shasum of the package to deploy. Required if deploying a remote package and `--insecure` is not provided")
121
-
122
123
packageDeployCmd.Flags().StringVar(&config.DeployOptions.SGetKeyPath, "sget", "", "Path to public sget key file for remote packages signed via cosign")
124
+
125
+
packageInspectCmd.Flags().StringVar(&config.CommonOptions.TempDirectory, "tmpdir", "", "Specify the temporary directory to use for intermediate files")
@@ -20,11 +21,11 @@ var prepareCmd = &cobra.Command{
20
21
}
21
22
22
23
varprepareTransformGitLinks=&cobra.Command{
23
-
Use: "patch-git [HOST] [FILE]",
24
+
Use: "patch-git [HOST] [FILE]",
24
25
Aliases: []string{"p"},
25
26
Short: "Converts all .git URLs to the specified Zarf HOST and with the Zarf URL pattern in a given FILE. NOTE: \n"+
26
-
"This should only be used for manifests that are not mutated by the Zarf Agent Mutating Webhook.",
27
-
Args: cobra.ExactArgs(2),
27
+
"This should only be used for manifests that are not mutated by the Zarf Agent Mutating Webhook.",
28
+
Args: cobra.ExactArgs(2),
28
29
Run: func(cmd*cobra.Command, args []string) {
29
30
host, fileName:=args[0], args[1]
30
31
@@ -57,10 +58,10 @@ var prepareTransformGitLinks = &cobra.Command{
57
58
}
58
59
59
60
varprepareComputeFileSha256sum=&cobra.Command{
60
-
Use: "sha256sum [FILE|URL]",
61
+
Use: "sha256sum [FILE|URL]",
61
62
Aliases: []string{"s"},
62
-
Short: "Generate a SHA256SUM for the given file",
63
-
Args: cobra.ExactArgs(1),
63
+
Short: "Generate a SHA256SUM for the given file",
64
+
Args: cobra.ExactArgs(1),
64
65
Run: func(cmd*cobra.Command, args []string) {
65
66
fileName:=args[0]
66
67
hash, err:=utils.GetSha256Sum(fileName)
@@ -75,7 +76,7 @@ var prepareComputeFileSha256sum = &cobra.Command{
75
76
varprepareFindImages=&cobra.Command{
76
77
Use: "find-images",
77
78
Aliases: []string{"f"},
78
-
Args: cobra.MaximumNArgs(1),
79
+
Args: cobra.MaximumNArgs(1),
79
80
Short: "Evaluates components in a zarf file to identify images specified in their helm charts and manifests",
80
81
Long: "Evaluates components in a zarf file to identify images specified in their helm charts and manifests.\n\n"+
81
82
"Components that have repos that host helm charts can be processed by providing the --repo-chart-path.",
@@ -98,5 +99,5 @@ func init() {
98
99
prepareCmd.AddCommand(prepareFindImages)
99
100
100
101
prepareFindImages.Flags().StringVarP(&repoHelmChartPath, "repo-chart-path", "p", "", `If git repos hold helm charts, often found with gitops tools, specify the chart path, e.g. "/" or "/chart"`)
101
-
102
+
prepareFindImages.Flags().StringVar(&config.CommonOptions.TempDirectory, "tmpdir", "", "Specify the temporary directory to use for intermediate files")
0 commit comments