From 79495c91726555ad1b82d8b564b3033a047ffbca Mon Sep 17 00:00:00 2001 From: Sam Tholiya Date: Fri, 13 Dec 2024 22:01:55 +0100 Subject: [PATCH] Add support for helmfile version command issue: https://linear.app/cloudposse/issue/DEV-2844/atmos-helmfile-version-does-not-work --- internal/exec/helmfile.go | 4 ++++ internal/exec/utils.go | 13 +++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/exec/helmfile.go b/internal/exec/helmfile.go index bfcfde41a..fe36f7e9f 100644 --- a/internal/exec/helmfile.go +++ b/internal/exec/helmfile.go @@ -54,6 +54,10 @@ func ExecuteHelmfile(info schema.ConfigAndStacksInfo) error { return nil } + if info.SubCommand == "version" { + return ExecuteShellCommand(cliConfig, "helmfile", []string{info.SubCommand}, "", nil, false, info.RedirectStdErr) + } + info, err = ProcessStacks(cliConfig, info, true, true) if err != nil { return err diff --git a/internal/exec/utils.go b/internal/exec/utils.go index 6fefa53ba..46693a4ba 100644 --- a/internal/exec/utils.go +++ b/internal/exec/utils.go @@ -661,22 +661,19 @@ func processArgsAndFlags(componentType string, inputArgsAndFlags []string) (sche var indexesToRemove []int // For commands like `atmos terraform clean` and `atmos terraform plan`, show the command help - if len(inputArgsAndFlags) == 1 { + if len(inputArgsAndFlags) == 1 && inputArgsAndFlags[0] != "version" { info.SubCommand = inputArgsAndFlags[0] info.NeedHelp = true return info, nil } - - // https://github.com/roboll/helmfile#cli-reference - var globalOptionsFlagIndex int - - // For commands like `atmos terraform clean` and `atmos terraform plan`, show the command help - if len(inputArgsAndFlags) == 1 { + if len(inputArgsAndFlags) == 1 && inputArgsAndFlags[0] == "version" { info.SubCommand = inputArgsAndFlags[0] - info.NeedHelp = true return info, nil } + // https://github.com/roboll/helmfile#cli-reference + var globalOptionsFlagIndex int + for i, arg := range inputArgsAndFlags { if arg == cfg.GlobalOptionsFlag { globalOptionsFlagIndex = i + 1