diff --git a/cmd/cmd_utils.go b/cmd/cmd_utils.go index df92e21fd..b2c78ee15 100644 --- a/cmd/cmd_utils.go +++ b/cmd/cmd_utils.go @@ -17,6 +17,21 @@ import ( u "github.com/cloudposse/atmos/pkg/utils" ) +// ValidateConfig holds configuration options for Atmos validation. +// CheckStack determines whether stack configuration validation should be performed. +type ValidateConfig struct { + CheckStack bool + // Other configuration fields +} + +type AtmosValidateOption func(*ValidateConfig) + +func WithStackValidation(check bool) AtmosValidateOption { + return func(cfg *ValidateConfig) { + cfg.CheckStack = check + } +} + // processCustomCommands processes and executes custom commands func processCustomCommands( cliConfig schema.CliConfiguration, @@ -323,17 +338,27 @@ func cloneCommand(orig *schema.Command) (*schema.Command, error) { } // checkAtmosConfig checks Atmos config -func checkAtmosConfig() { +func checkAtmosConfig(opts ...AtmosValidateOption) { + vCfg := &ValidateConfig{ + CheckStack: true, // Default value true to check the stack + } + + // Apply options + for _, opt := range opts { + opt(vCfg) + } + cliConfig, err := cfg.InitCliConfig(schema.ConfigAndStacksInfo{}, false) if err != nil { u.LogErrorAndExit(cliConfig, err) } - atmosConfigExists, err := u.IsDirectory(cliConfig.StacksBaseAbsolutePath) - - if !atmosConfigExists || err != nil { - printMessageForMissingAtmosConfig(cliConfig) - os.Exit(0) + if vCfg.CheckStack { + atmosConfigExists, err := u.IsDirectory(cliConfig.StacksBaseAbsolutePath) + if !atmosConfigExists || err != nil { + printMessageForMissingAtmosConfig(cliConfig) + os.Exit(0) + } } } diff --git a/cmd/vendor_pull.go b/cmd/vendor_pull.go index d486ea114..50fe6cec1 100644 --- a/cmd/vendor_pull.go +++ b/cmd/vendor_pull.go @@ -15,8 +15,9 @@ var vendorPullCmd = &cobra.Command{ Long: `This command executes 'atmos vendor pull' CLI commands`, FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false}, Run: func(cmd *cobra.Command, args []string) { - // Check Atmos configuration - checkAtmosConfig() + // WithStackValidation is a functional option that enables/disables stack configuration validation + // based on whether the --stack flag is provided + checkAtmosConfig(WithStackValidation(cmd.Flag("stack").Changed)) err := e.ExecuteVendorPullCmd(cmd, args) if err != nil { diff --git a/examples/quick-start-advanced/Dockerfile b/examples/quick-start-advanced/Dockerfile index 7f3fbeb66..91ef605a5 100644 --- a/examples/quick-start-advanced/Dockerfile +++ b/examples/quick-start-advanced/Dockerfile @@ -1,12 +1,12 @@ # Geodesic: https://github.com/cloudposse/geodesic/ -ARG GEODESIC_VERSION=3.2.0 +ARG GEODESIC_VERSION=3.3.0 ARG GEODESIC_OS=debian # Atmos # https://atmos.tools/ # https://github.com/cloudposse/atmos # https://github.com/cloudposse/atmos/releases -ARG ATMOS_VERSION=1.93.0 +ARG ATMOS_VERSION=1.97.0 # Terraform: https://github.com/hashicorp/terraform/releases ARG TF_VERSION=1.9.8 diff --git a/go.mod b/go.mod index fc7939ba7..fe4ef0612 100644 --- a/go.mod +++ b/go.mod @@ -9,10 +9,10 @@ require ( github.com/arsham/figurine v1.3.0 github.com/bmatcuk/doublestar/v4 v4.7.1 github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.1.1 - github.com/charmbracelet/lipgloss v0.13.0 + github.com/charmbracelet/bubbletea v1.1.2 + github.com/charmbracelet/lipgloss v0.13.1 github.com/elewis787/boa v0.1.2 - github.com/fatih/color v1.17.0 + github.com/fatih/color v1.18.0 github.com/go-git/go-git/v5 v5.12.0 github.com/google/go-containerregistry v0.20.2 github.com/google/go-github/v59 v59.0.0 @@ -90,7 +90,7 @@ require ( github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chainguard-dev/git-urls v1.0.2 // indirect - github.com/charmbracelet/x/ansi v0.2.3 // indirect + github.com/charmbracelet/x/ansi v0.4.0 // indirect github.com/charmbracelet/x/term v0.2.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect diff --git a/go.sum b/go.sum index fa999c129..4e16398a4 100644 --- a/go.sum +++ b/go.sum @@ -385,12 +385,12 @@ github.com/chainguard-dev/git-urls v1.0.2 h1:pSpT7ifrpc5X55n4aTTm7FFUE+ZQHKiqpiw github.com/chainguard-dev/git-urls v1.0.2/go.mod h1:rbGgj10OS7UgZlbzdUQIQpT0k/D4+An04HJY7Ol+Y/o= github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= -github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= -github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= -github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= -github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= -github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/bubbletea v1.1.2 h1:naQXF2laRxyLyil/i7fxdpiz1/k06IKquhm4vBfHsIc= +github.com/charmbracelet/bubbletea v1.1.2/go.mod h1:9HIU/hBV24qKjlehyj8z1r/tR9TYTQEag+cWZnuXo8E= +github.com/charmbracelet/lipgloss v0.13.1 h1:Oik/oqDTMVA01GetT4JdEC033dNzWoQHdWnHnQmXE2A= +github.com/charmbracelet/lipgloss v0.13.1/go.mod h1:zaYVJ2xKSKEnTEEbX6uAHabh2d975RJ+0yfkFpRBz5U= +github.com/charmbracelet/x/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU= +github.com/charmbracelet/x/ansi v0.4.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= @@ -492,8 +492,8 @@ github.com/evanphx/json-patch/v5 v5.5.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= diff --git a/internal/exec/vendor_utils.go b/internal/exec/vendor_utils.go index 7858d683a..973bbd6a5 100644 --- a/internal/exec/vendor_utils.go +++ b/internal/exec/vendor_utils.go @@ -37,7 +37,7 @@ func ExecuteVendorPullCommand(cmd *cobra.Command, args []string) error { // system dir, home dir, current dir, ENV vars, command-line arguments cliConfig, err := cfg.InitCliConfig(info, processStacks) if err != nil { - return err + return fmt.Errorf("failed to initialize CLI config: %w", err) } dryRun, err := flags.GetBool("dry-run") diff --git a/website/docs/integrations/atlantis.mdx b/website/docs/integrations/atlantis.mdx index 878a94ec6..1c55430b2 100644 --- a/website/docs/integrations/atlantis.mdx +++ b/website/docs/integrations/atlantis.mdx @@ -673,7 +673,7 @@ on: branches: [ main ] env: - ATMOS_VERSION: 1.93.0 + ATMOS_VERSION: 1.97.0 ATMOS_CLI_CONFIG_PATH: ./ jobs: