Skip to content

Commit 2db6a8f

Browse files
committed
add a fallback command for checking helm binary version (v4.x) (#3373)
* add a fallback command for checking helm binary version (v4.x) * add debug log statement to highlight the command error and subsequent attempt for better clarity. (cherry picked from commit 1256000)
1 parent 0b11fc2 commit 2db6a8f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cli/create_helm.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,13 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags.
138138

139139
output, err := exec.Command(helmBinaryPath, "version", "--client", "--template", "{{.Version}}").Output()
140140
if err != nil {
141-
return err
141+
log.Debugf("error getting helm version: '%v'. Attempting again with commandline flags compatible with Helm v4.x..", err)
142+
143+
// Helm v4.x does not support the --client flag
144+
output, err = exec.Command(helmBinaryPath, "version", "--template", "{{.Version}}").Output()
145+
if err != nil {
146+
return err
147+
}
142148
}
143149

144150
err = clihelper.CheckHelmVersion(string(output))

0 commit comments

Comments
 (0)