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 <aiopsclub@163.com>
This commit is contained in:
parent
7712350d2a
commit
2ce62f22ac
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue