From 2ce62f22ac566c2505f86687b23a474c4ffcc22e Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sat, 24 Jan 2026 14:48:21 +0800 Subject: [PATCH] fix: prevent --args flags from being passed to helm repo commands When helmfile template --args is used, the extra flags were being passed to helm repo update and helm repo add commands, which don't support all flags that helm template/install support. This caused failures when flags like --dry-run were passed via --args. The fix saves the extra flags before executing helm repo commands, clears them, and restores them afterwards to ensure repo commands run without unsupported flags. Fixes CI issue in PR #2378 where test issue-1749 fails with "Error: unknown flag: --dry-run" during helm repo update. Signed-off-by: yxxhero --- pkg/helmexec/exec.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/helmexec/exec.go b/pkg/helmexec/exec.go index 34a6e5dc..08f1d5d3 100644 --- a/pkg/helmexec/exec.go +++ b/pkg/helmexec/exec.go @@ -204,6 +204,12 @@ func (helm *execer) AddRepo(name, repository, cafile, certfile, keyfile, usernam return fmt.Errorf("empty field name") } + savedExtra := helm.extra + helm.extra = []string{} + defer func() { + helm.extra = savedExtra + }() + switch managed { case "acr": helm.logger.Infof("Adding repo %v (acr)", name) @@ -252,6 +258,11 @@ func (helm *execer) AddRepo(name, repository, cafile, certfile, keyfile, usernam func (helm *execer) UpdateRepo() error { helm.logger.Info("Updating repo") + savedExtra := helm.extra + helm.extra = []string{} + defer func() { + helm.extra = savedExtra + }() out, err := helm.exec([]string{"repo", "update"}, map[string]string{}, nil) helm.info(out) return err