Skip to content

Commit 797a2e8

Browse files
loft-botneogopher
andauthored
add a fallback command for checking helm binary version (v4.x) (#3373) (#3393)
* 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) Co-authored-by: Sachin Lobo <[email protected]>
1 parent ee1a87a commit 797a2e8

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
@@ -139,7 +139,13 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags.
139139

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

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

0 commit comments

Comments
 (0)