Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
Signed-off-by: yxxhero <[email protected]>
  • Loading branch information
yxxhero committed Feb 13, 2024
1 parent f4629d4 commit fb7c54e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
f.StringArrayVar(&applyOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`)
f.StringVar(&applyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
f.StringVar(&applyOptions.DryRun, "dry-run", "", "pass dry-run to helm exec")
f.Lookup("dry-run").NoOptDefVal = "client"

return cmd
}
1 change: 1 addition & 0 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
f.StringArrayVar(&syncOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`)
f.StringVar(&syncOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
f.StringVar(&syncOptions.DryRun, "dry-run", "", "pass dry-run to helm exec")
f.Lookup("dry-run").NoOptDefVal = "client"

return cmd
}
7 changes: 2 additions & 5 deletions pkg/state/helmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ func (st *HelmState) appendDryRunFlags(flags []string, helm helmexec.Interface,
if !helm.IsVersionAtLeast("3.13.0") {
return flags
}
switch {
case opt != nil && opt.DryRun != "":
flags = append(flags, "--dry-run", opt.DryRun)
case opt != nil && opt.DryRun == "":
flags = append(flags, "--dry-run", "client")
if opt != nil && opt.DryRun != "" {
flags = append(flags, fmt.Sprintf("--dry-run=%s", opt.DryRun))
}
return flags
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/state/helmx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "client",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "client"},
expected: []string{"--dry-run=client"},
},
},
{
Expand All @@ -224,7 +224,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "client"},
expected: []string{},
},
},
{
Expand All @@ -233,7 +233,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "server",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "server"},
expected: []string{"--dry-run=server"},
},
},
{
Expand Down
3 changes: 0 additions & 3 deletions test/integration/test-cases/happypath/input/happypath.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ repositories:
- name: incubator
url: https://charts.helm.sh/incubator

helmDefaults:
kubeContext: minikube

releases:

- name: httpbin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ repositories:
- name: incubator
url: https://charts.helm.sh/incubator

helmDefaults:
kubeContext: minikube

releases:

- name: raw
Expand Down

0 comments on commit fb7c54e

Please sign in to comment.