Fix panic when helm isn't installed (#2169)

Return error instead of panic

Signed-off-by: Nick Neisen <nwneisen@gmail.com>
This commit is contained in:
Nick Neisen
2025-09-09 07:15:46 +08:00
committed by GitHub
parent 55030e4eee
commit f708d06200
8 changed files with 189 additions and 72 deletions
+3 -4
View File
@@ -122,11 +122,10 @@ func redactedURL(chart string) string {
}
// New for running helm commands
func New(helmBinary string, options HelmExecOptions, logger *zap.SugaredLogger, kubeconfig string, kubeContext string, runner Runner) *execer {
// TODO: proper error handling
func New(helmBinary string, options HelmExecOptions, logger *zap.SugaredLogger, kubeconfig string, kubeContext string, runner Runner) (*execer, error) {
version, err := GetHelmVersion(helmBinary, runner)
if err != nil {
panic(err)
return nil, err
}
if version.Prerelease() != "" {
@@ -143,7 +142,7 @@ func New(helmBinary string, options HelmExecOptions, logger *zap.SugaredLogger,
kubeContext: kubeContext,
runner: runner,
decryptedSecrets: make(map[string]*decryptedSecret),
}
}, nil
}
func (helm *execer) SetExtraArgs(args ...string) {