fix(helm): Improve error message when helm cmd fails (#26159)

Signed-off-by: Oliver Gondža <ogondza@gmail.com>
This commit is contained in:
Oliver Gondža
2026-01-27 21:58:03 +01:00
committed by GitHub
parent c2e594c5f5
commit afdf99f33a
2 changed files with 3 additions and 3 deletions

View File

@@ -70,11 +70,11 @@ func (c Cmd) run(ctx context.Context, args ...string) (string, string, error) {
}
cmd.Env = proxy.UpsertEnv(cmd, c.proxy, c.noProxy)
fullCommand := executil.GetCommandArgsToLog(cmd)
out, err := c.runWithRedactor(cmd, redactor)
fullCommand := executil.GetCommandArgsToLog(cmd)
if err != nil {
return out, fullCommand, fmt.Errorf("failed to get command args to log: %w", err)
return out, fullCommand, fmt.Errorf("failed running helm: %w", err)
}
return out, fullCommand, nil
}

View File

@@ -90,7 +90,7 @@ func TestRegistryLogin(t *testing.T) {
repo: "my.registry.com/repo",
creds: &HelmCreds{},
execErr: errors.New("exit status 1"),
expectedErr: errors.New("failed to login to registry: failed to get command args to log: exit status 1"),
expectedErr: errors.New("failed to login to registry: failed running helm: exit status 1"),
},
{
name: "invalid repo",