feat: Modernize Helmfile EKS integration#1903
Conversation
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR modernizes Helmfile EKS integration by making EKS opt-in, replacing pattern-based AWS authentication with identity-based auth, and introducing flexible cluster name configuration via templates and CLI flags. Includes command restructuring, new helmfile resolution package, and comprehensive deprecation warnings for legacy options. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes The changes encompass substantial logic refactoring (helmfile resolution precedence, EKS opt-in), new public APIs (helmfile package), command restructuring with provider pattern, CLI flag additions, schema/config changes, and deprecation handling across multiple layers. While cohesively scoped around helmfile modernization, the variety of concerns—logic, structure, configuration, and CLI—and spread across many files demands careful reasoning per functional area. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1903 +/- ##
==========================================
+ Coverage 76.10% 76.20% +0.10%
==========================================
Files 798 799 +1
Lines 74821 75021 +200
==========================================
+ Hits 56944 57172 +228
+ Misses 14325 14287 -38
- Partials 3552 3562 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/exec/aws_eks_update_kubeconfig.go (1)
185-211: Logic is correct; consider consolidating with helmfile package.The precedence logic and deprecation warnings are sound. However,
internal/exec/helmfile.gouseshelmfile.ResolveClusterNamefor the same resolution flow. This inline implementation duplicates that logic.Consider refactoring to use the same
helmfile.ResolveClusterNamefunction for consistency, or extract a shared helper to avoid drift between the two resolution paths.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (28)
errors/errors.goexamples/quick-start-advanced/atmos.yamlexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yamlinternal/exec/aws_eks_update_kubeconfig.gointernal/exec/cli_utils.gointernal/exec/cli_utils_test.gointernal/exec/helmfile.gointernal/exec/helmfile_utils.gointernal/exec/helmfile_utils_test.gopkg/config/const.gopkg/config/default.gopkg/helmfile/auth.gopkg/helmfile/auth_test.gopkg/helmfile/cluster.gopkg/helmfile/cluster_test.gopkg/schema/schema.gotests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldentests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_indentation.stdout.goldenwebsite/blog/2025-01-15-helmfile-eks-modernization.mdxwebsite/docs/cli/configuration/components/helmfile.mdx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: NEVER use fmt.Fprintf(os.Stdout/Stderr) or fmt.Println(); use data.* or ui.* functions instead
All comments must end with periods (enforced by godot linter)
Organize imports in three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages; maintain aliases: cfg, log, u, errUtils
Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions for performance tracking; use nil if no atmosConfig param
All errors MUST be wrapped using static errors defined in errors/errors.go; use errors.Join for combining multiple errors; use fmt.Errorf with %w for adding string context; use error builder for complex errors; use errors.Is() for error checking; NEVER use dynamic errors directly
Use go.uber.org/mock/mockgen with //go:generate directives for mock generation; never create manual mocks
Keep files small...
Files:
pkg/helmfile/cluster.gopkg/helmfile/auth_test.gointernal/exec/helmfile_utils.gointernal/exec/cli_utils_test.gopkg/config/const.gopkg/helmfile/auth.gointernal/exec/aws_eks_update_kubeconfig.goerrors/errors.gointernal/exec/helmfile.gopkg/schema/schema.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.gopkg/helmfile/cluster_test.gopkg/config/default.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
**/*_test.go: Prefer unit tests with mocks over integration tests; use interfaces + dependency injection for testability; generate mocks with go.uber.org/mock/mockgen; use table-driven tests; target >80% coverage
Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking
Files:
pkg/helmfile/auth_test.gointernal/exec/cli_utils_test.gointernal/exec/helmfile_utils_test.gopkg/helmfile/cluster_test.go
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/docs/cli/configuration/components/helmfile.mdxwebsite/blog/2025-01-15-helmfile-eks-modernization.mdx
website/blog/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
website/blog/**/*.mdx: Follow PR template (what/why/references); PRs labeled minor/major MUST include blog post at website/blog/YYYY-MM-DD-feature-name.mdx with YAML front matter, after intro, and only tags from website/blog/tags.yml
Blog posts MUST use only tags defined in website/blog/tags.yml and authors defined in website/blog/authors.yml; valid tags are: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core; never invent new tags
Files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
🧠 Learnings (58)
📓 Common learnings
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldenpkg/helmfile/cluster.gotests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldeninternal/exec/helmfile_utils.gowebsite/docs/cli/configuration/components/helmfile.mdxtests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldeninternal/exec/cli_utils_test.gotests/snapshots/TestCLICommands_indentation.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldeninternal/exec/aws_eks_update_kubeconfig.goexamples/quick-start-advanced/atmos.yamlwebsite/blog/2025-01-15-helmfile-eks-modernization.mdxerrors/errors.gointernal/exec/helmfile.gotests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldenpkg/schema/schema.gointernal/exec/helmfile_utils_test.goexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yamlpkg/helmfile/cluster_test.gopkg/config/default.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldenpkg/helmfile/cluster.gotests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldeninternal/exec/helmfile_utils.gotests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldeninternal/exec/cli_utils_test.gotests/snapshots/TestCLICommands_indentation.stdout.goldenpkg/config/const.gotests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldeninternal/exec/aws_eks_update_kubeconfig.goexamples/quick-start-advanced/atmos.yamltests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldenerrors/errors.gointernal/exec/helmfile.gotests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldenpkg/schema/schema.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.goexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yamlpkg/config/default.go
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldenexamples/quick-start-advanced/atmos.yamltests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldenexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldenwebsite/docs/cli/configuration/components/helmfile.mdxtests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
📚 Learning: 2025-12-13T03:21:35.786Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:35.786Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldeninternal/exec/helmfile_utils.gowebsite/docs/cli/configuration/components/helmfile.mdxinternal/exec/aws_eks_update_kubeconfig.gointernal/exec/helmfile.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.goexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2024-10-20T13:12:46.499Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldeninternal/exec/helmfile_utils.gotests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldeninternal/exec/helmfile.gotests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldeninternal/exec/helmfile_utils_test.goexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-08-16T23:32:40.412Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:455-456
Timestamp: 2025-08-16T23:32:40.412Z
Learning: In the cloudposse/atmos Go codebase, `InitCliConfig` returns a `schema.AtmosConfiguration` value (not a pointer), while `ExecuteDescribeDependents` expects a `*schema.AtmosConfiguration` pointer parameter. Therefore, when passing the result of `InitCliConfig` to `ExecuteDescribeDependents`, use `&atmosConfig` to pass the address of the value.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldeninternal/exec/helmfile_utils.gotests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldeninternal/exec/helmfile.gotests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.goldeninternal/exec/helmfile_utils_test.gointernal/exec/cli_utils.go
📚 Learning: 2025-02-14T23:12:38.030Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-02-14T23:12:38.030Z
Learning: Test snapshots in the Atmos project, particularly for dry run scenarios, may be updated during the development process, and temporary inconsistencies in their content should not be flagged as issues.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldentests/snapshots/TestCLICommands_describe_component_with_current_directory_(.).stdout.goldentests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldentests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldenwebsite/docs/cli/configuration/components/helmfile.mdxtests/snapshots/TestCLICommands_describe_component_with_relative_path.stdout.goldenexamples/quick-start-advanced/atmos.yamltests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.golden
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldenexamples/quick-start-advanced/atmos.yamlexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-12-13T04:37:25.223Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: cmd/root.go:0-0
Timestamp: 2025-12-13T04:37:25.223Z
Learning: In Atmos cmd/root.go Execute(), after cfg.InitCliConfig, we must call both toolchainCmd.SetAtmosConfig(&atmosConfig) and toolchain.SetAtmosConfig(&atmosConfig) so the CLI wrapper and the toolchain package receive configuration; missing either can cause nil-pointer panics in toolchain path resolution.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.goldeninternal/exec/helmfile_utils.gointernal/exec/cli_utils.go
📚 Learning: 2024-11-25T17:17:15.703Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 797
File: pkg/list/atmos.yaml:213-214
Timestamp: 2024-11-25T17:17:15.703Z
Learning: The file `pkg/list/atmos.yaml` is primarily intended for testing purposes.
Applied to files:
tests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.goldenwebsite/docs/cli/configuration/components/helmfile.mdxtests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldenexamples/quick-start-advanced/atmos.yamlexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_describe_component_from_nested_dir_discovers_atmos.yaml_in_parent.stdout.goldenwebsite/docs/cli/configuration/components/helmfile.mdxtests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldenexamples/quick-start-advanced/atmos.yamlexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-12-21T04:10:29.030Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: internal/exec/describe_affected.go:468-468
Timestamp: 2025-12-21T04:10:29.030Z
Learning: In Go, package-level declarations (constants, variables, types, and functions) are visible to all files in the same package without imports. During reviews in cloudposse/atmos (and similar Go codebases), before suggesting to declare a new identifier, first check if it already exists in another file of the same package. If it exists, you can avoid adding a new declaration; if not, proceed with a proper package-level declaration.
Applied to files:
pkg/helmfile/cluster.gopkg/helmfile/auth_test.gointernal/exec/helmfile_utils.gointernal/exec/cli_utils_test.gopkg/config/const.gopkg/helmfile/auth.gointernal/exec/aws_eks_update_kubeconfig.goerrors/errors.gointernal/exec/helmfile.gopkg/schema/schema.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.gopkg/helmfile/cluster_test.gopkg/config/default.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios in Go
Applied to files:
pkg/helmfile/auth_test.gointernal/exec/cli_utils_test.gointernal/exec/helmfile_utils_test.go
📚 Learning: 2025-09-29T02:20:11.636Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/validate_component.go:117-118
Timestamp: 2025-09-29T02:20:11.636Z
Learning: The ValidateComponent function in internal/exec/validate_component.go had its componentSection parameter type refined from `any` to `map[string]any` without adding new parameters. This is a type safety improvement, not a signature change requiring call site updates.
Applied to files:
internal/exec/helmfile_utils.gotests/snapshots/TestCLICommands_describe_component_with_component_name_(backward_compatibility).stdout.golden
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
internal/exec/helmfile_utils.gotests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.golden
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
internal/exec/helmfile_utils.gowebsite/docs/cli/configuration/components/helmfile.mdxinternal/exec/aws_eks_update_kubeconfig.goexamples/quick-start-advanced/atmos.yamlinternal/exec/helmfile.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.goexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
internal/exec/helmfile_utils.gointernal/exec/helmfile.gointernal/exec/helmfile_utils_test.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
internal/exec/helmfile_utils.go
📚 Learning: 2025-04-11T22:06:46.999Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.
Applied to files:
internal/exec/helmfile_utils.go
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
website/docs/cli/configuration/components/helmfile.mdx
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.goldenexamples/quick-start-advanced/atmos.yamlexamples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
Applied to files:
internal/exec/cli_utils_test.gointernal/exec/helmfile_utils_test.gopkg/helmfile/cluster_test.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*_test.go : Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking
Applied to files:
internal/exec/cli_utils_test.gointernal/exec/helmfile_utils_test.go
📚 Learning: 2025-12-10T18:32:51.237Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1808
File: cmd/terraform/backend/backend_delete_test.go:9-23
Timestamp: 2025-12-10T18:32:51.237Z
Learning: In cmd subpackages (e.g., cmd/terraform/backend/), tests cannot use cmd.NewTestKit(t) due to Go's test visibility rules (NewTestKit is in a parent package test file). These tests only need TestKit if they execute commands through RootCmd or modify RootCmd state. Structural tests that only verify command structure/flags without touching RootCmd don't require TestKit cleanup.
Applied to files:
internal/exec/cli_utils_test.go
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
pkg/config/const.gointernal/exec/cli_utils.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
internal/exec/aws_eks_update_kubeconfig.gointernal/exec/helmfile.gointernal/exec/helmfile_utils_test.gointernal/exec/cli_utils.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
examples/quick-start-advanced/atmos.yaml
📚 Learning: 2024-12-01T00:33:20.298Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldeninternal/exec/cli_utils.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldeninternal/exec/cli_utils.go
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.goldeninternal/exec/cli_utils.go
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_-help_passthrough.stdout.golden
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*.go : All errors MUST be wrapped using static errors defined in errors/errors.go; use errors.Join for combining multiple errors; use fmt.Errorf with %w for adding string context; use error builder for complex errors; use errors.Is() for error checking; NEVER use dynamic errors directly
Applied to files:
errors/errors.go
📚 Learning: 2025-12-13T06:10:13.688Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
Applied to files:
errors/errors.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: The user confirmed that the errors package has an error string wrapping format, contradicting the previous learning about ErrWrappingFormat being invalid. The current usage of fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) appears to be the correct pattern.
Applied to files:
errors/errors.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: ErrWrappingFormat is correctly defined as "%w: %w" in the errors package and is used throughout the codebase to wrap two error types together. The usage fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) is the correct pattern when both arguments are error types.
Applied to files:
errors/errors.go
📚 Learning: 2024-12-05T22:33:54.807Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 820
File: cmd/list_stacks.go:55-56
Timestamp: 2024-12-05T22:33:54.807Z
Learning: In the atmos project, the `u.LogErrorAndExit` function logs the error and exits the command execution appropriately within flag completion functions.
Applied to files:
internal/exec/helmfile.go
📚 Learning: 2025-01-18T15:15:41.645Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform.go:37-46
Timestamp: 2025-01-18T15:15:41.645Z
Learning: In the atmos CLI, error handling is intentionally structured to use LogErrorAndExit for consistent error display, avoiding Cobra's default error handling to prevent duplicate error messages.
Applied to files:
internal/exec/helmfile.go
📚 Learning: 2024-12-05T22:33:40.955Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 820
File: cmd/list_components.go:53-54
Timestamp: 2024-12-05T22:33:40.955Z
Learning: In the Atmos CLI Go codebase, using `u.LogErrorAndExit` within completion functions is acceptable because it logs the error and exits the command execution.
Applied to files:
internal/exec/helmfile.go
📚 Learning: 2025-01-30T19:30:59.120Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.
Applied to files:
internal/exec/helmfile.go
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.
Applied to files:
internal/exec/helmfile.gointernal/exec/helmfile_utils_test.go
📚 Learning: 2025-10-11T19:12:38.832Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: tests/snapshots/TestCLICommands_atmos_workflow_invalid_step_type.stderr.golden:0-0
Timestamp: 2025-10-11T19:12:38.832Z
Learning: Usage Examples sections in error output are appropriate for command usage errors (incorrect syntax, missing arguments, invalid flags) but not for configuration validation errors (malformed workflow files, invalid settings in atmos.yaml). Configuration errors should focus on explaining what's wrong with the config, not command usage patterns.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-10-22T14:55:44.014Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1695
File: pkg/auth/manager.go:169-171
Timestamp: 2025-10-22T14:55:44.014Z
Learning: Go 1.20+ supports multiple %w verbs in fmt.Errorf, which returns an error implementing Unwrap() []error. This is valid and does not panic. Atmos uses Go 1.24.8 and configures errorlint with errorf-multi: true to validate this pattern.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-08-16T23:33:07.477Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:651-652
Timestamp: 2025-08-16T23:33:07.477Z
Learning: In the cloudposse/atmos Go codebase, ExecuteDescribeDependents expects a pointer to AtmosConfiguration (*schema.AtmosConfiguration), so when calling it with a value returned by cfg.InitCliConfig (which returns schema.AtmosConfiguration), the address-of operator (&) is necessary: ExecuteDescribeDependents(&atmosConfig, ...).
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-11-10T23:23:39.771Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/registry/aqua/aqua_test.go:417-442
Timestamp: 2025-11-10T23:23:39.771Z
Learning: In Atmos toolchain AquaRegistry, tests should not hit real GitHub. Use the options pattern via WithGitHubBaseURL to inject an httptest server URL and make GetLatestVersion/GetAvailableVersions deterministic.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
internal/exec/helmfile_utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Applied to files:
internal/exec/cli_utils.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Use Viper for managing configuration, environment variables, and flags in CLI commands
Applied to files:
internal/exec/cli_utils.go
📚 Learning: 2025-05-22T15:42:10.906Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1261
File: internal/exec/utils.go:639-640
Timestamp: 2025-05-22T15:42:10.906Z
Learning: In the Atmos codebase, when appending slices with `args := append(configAndStacksInfo.CliArgs, configAndStacksInfo.AdditionalArgsAndFlags...)`, it's intentional that the result is not stored back in the original slice. This pattern is used when the merged result serves a different purpose than the original slices, such as when creating a filtered version for component section assignments.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: 2025-12-13T06:10:25.156Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: internal/exec/workflow_utils.go:0-0
Timestamp: 2025-12-13T06:10:25.156Z
Learning: Atmos workflows: In internal/exec/workflow_utils.go ExecuteWorkflow, non-identity steps intentionally use baseWorkflowEnv, which is constructed from the parent environment with PATH modifications for the toolchain. Avoid appending os.Environ() again; prefer documenting this behavior and testing that standard environment variables are preserved.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: 2025-09-10T17:34:52.568Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/providers/github/oidc.go:96-100
Timestamp: 2025-09-10T17:34:52.568Z
Learning: The ATMOS_ environment variable binding guideline applies to Atmos configuration variables, not external service-required environment variables like GitHub Actions OIDC variables (GITHUB_ACTIONS, ACTIONS_ID_TOKEN_*) which must use their standard names.
Applied to files:
examples/quick-start-advanced/rootfs/usr/local/etc/atmos/atmos.yaml
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*_test.go : Prefer unit tests with mocks over integration tests; use interfaces + dependency injection for testability; generate mocks with go.uber.org/mock/mockgen; use table-driven tests; target >80% coverage
Applied to files:
pkg/helmfile/cluster_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Applied to files:
pkg/helmfile/cluster_test.go
🧬 Code graph analysis (6)
pkg/helmfile/auth_test.go (3)
pkg/helmfile/cluster.go (1)
Context(14-14)pkg/helmfile/auth.go (2)
AuthInput(12-17)ResolveAWSAuth(34-61)errors/errors.go (1)
ErrMissingHelmfileAuth(384-384)
internal/exec/cli_utils_test.go (1)
pkg/schema/schema.go (1)
ArgsAndFlagsInfo(564-606)
internal/exec/aws_eks_update_kubeconfig.go (3)
internal/exec/template_utils.go (1)
ProcessTmpl(53-97)pkg/logger/log.go (1)
Warn(44-46)pkg/config/utils.go (1)
ReplaceContextTokens(828-843)
internal/exec/helmfile.go (3)
pkg/helmfile/cluster.go (2)
ClusterNameInput(17-26)ResolveClusterName(53-106)pkg/helmfile/auth.go (2)
AuthInput(12-17)ResolveAWSAuth(34-61)pkg/auth/types/interfaces.go (1)
Identity(121-170)
internal/exec/helmfile_utils_test.go (2)
pkg/schema/schema.go (3)
AtmosConfiguration(54-99)Components(430-443)Helmfile(414-423)errors/errors.go (2)
ErrMissingHelmfileBasePath(379-379)ErrMissingHelmfileKubeconfigPath(380-380)
pkg/helmfile/cluster_test.go (3)
pkg/helmfile/cluster.go (3)
TemplateProcessor(40-46)Context(14-14)ClusterNameInput(17-26)pkg/schema/schema.go (1)
AtmosConfiguration(54-99)errors/errors.go (1)
ErrMissingHelmfileClusterName(383-383)
🪛 LanguageTool
website/blog/2025-01-15-helmfile-eks-modernization.mdx
[typographical] ~102-~102: To join two clauses or introduce examples, consider using an em dash.
Context: ...when used: - helm_aws_profile_pattern - Use --identity flag instead - `cluster...
(DASH_RULE)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (7)
cmd/helmfile/utils.go (1)
18-26: Consider using lo.Contains for cleaner help detection.The manual loop works fine but you could simplify with:
return lo.Contains(args, "-h") || lo.Contains(args, "--help") || lo.Contains(args, "help")🔎 Proposed refactor
-func isHelpRequest(args []string) bool { - for _, arg := range args { - if arg == "-h" || arg == "--help" || arg == "help" { - return true - } - } - return false -} +func isHelpRequest(args []string) bool { + return lo.Contains(args, "-h") || lo.Contains(args, "--help") || lo.Contains(args, "help") +}cmd/helmfile/apply.go (1)
5-14: Comments and examples are clear.All comments properly end with periods. The inline examples are straightforward and helpful.
Per coding guidelines, consider externalizing examples to
cmd/markdown/helmfile_apply_usage.mdand embedding with//go:embed+utils.PrintfMarkdown(). However, for simple examples like these, inline is perfectly acceptable.cmd/helmfile/generate/varfile.go (1)
19-28: Minor: Redundant flag parsing configuration.Line 20 explicitly sets
DisableFlagParsing = false, which is already the default. This can be removed for cleaner code.🔎 Proposed simplification
func init() { - varfileCmd.DisableFlagParsing = false varfileCmd.PersistentFlags().StringP("stack", "s", "", "Specify the stack name")cmd/helmfile/helmfile.go (1)
40-57: Minor: Misleading comment about flag parsing.The comment at line 47 states "flag parsing is disabled for helmfile commands," but actually
FParseErrWhitelist.UnknownFlags=trueis used (as explained in init comment), which enables lenient parsing rather than disabling it entirely. Consider updating for clarity.🔎 Suggested comment correction
// Enable heatmap tracking if --heatmap flag is present in os.Args - // (needed because flag parsing is disabled for helmfile commands). + // (needed because unknown flags pass through via FParseErrWhitelist). enableHeatmapIfRequested()cmd/aws/eks/update_kubeconfig_test.go (1)
9-12: Consider expanding test coverage.The test currently validates only the error case when no parameters are provided. Consider adding table-driven tests to cover:
- Various flag combinations (profile, name, region, etc.)
- Stack-based resolution vs. explicit parameters
- Component argument handling
This would improve confidence in the command's parameter validation and error handling.
cmd/aws/eks/update_kubeconfig.go (1)
11-36: Consider constraining positional arguments.The command accepts any number of positional arguments but only uses the first one (component name). Consider adding
Args: cobra.MaximumNArgs(1)to make the expected behavior explicit and provide better error messages when users provide unexpected extra arguments.🔎 Proposed refinement
var updateKubeconfigCmd = &cobra.Command{ Use: "update-kubeconfig", Short: "Update `kubeconfig` for an EKS cluster using AWS CLI", Long: `This command executes ` + "`" + `aws eks update-kubeconfig` + "`" + ` to download ` + "`" + `kubeconfig` + "`" + ` from an EKS cluster and saves it to a file. The command executes ` + "`" + `aws eks update-kubeconfig` + "`" + ` in three different ways: 1. If all the required parameters (cluster name and AWS profile/role) are provided on the command-line, then ` + "`" + `atmos` + "`" + ` executes the command without requiring the ` + "`" + `atmos.yaml` + "`" + ` CLI config and context. 2. If 'component' and 'stack' are provided on the command-line, then ` + "`" + `atmos` + "`" + ` executes the command using the ` + "`" + `atmos.yaml` + "`" + ` CLI config and stack's context by searching for the following settings: - 'components.helmfile.cluster_name_pattern' in the 'atmos.yaml' CLI config (and calculates the '--name' parameter using the pattern) - 'components.helmfile.helm_aws_profile_pattern' in the 'atmos.yaml' CLI config (and calculates the ` + "`" + `--profile` + "`" + ` parameter using the pattern) - 'components.helmfile.kubeconfig_path' in the 'atmos.yaml' CLI config - the variables for the component in the provided stack - 'region' from the variables for the component in the stack 3. Combination of the above. Provide a component and a stack, and override other parameters on the command line. See https://docs.aws.amazon.com/cli/latest/reference/eks/update-kubeconfig.html for more information.`, FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false}, + Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { defer perf.Track(nil, "eks.updateKubeconfig.RunE")() return e.ExecuteAwsEksUpdateKubeconfigCommand(cmd, args) }, }tests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden (1)
10-13: The message formatting could be smoother, but<command>placeholder is intentional.The error message comes from
pkg/component/resolver.gowhere<command>is a literal placeholder in the help text—it's meant to show users what they should substitute. That's by design.The awkward punctuation is real though. The source code format string has backticks around
atmos %s <command> %s, and when those backticks are stripped during rendering, you get the space-period-space pattern:atmos helmfile <command> . The path points to:. Smoothing this to a dash or combining the sentences would improve readability without changing the core message.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (24)
cmd/aws.gocmd/aws/aws.gocmd/aws/eks/eks.gocmd/aws/eks/update_kubeconfig.gocmd/aws/eks/update_kubeconfig_test.gocmd/helmfile.gocmd/helmfile/apply.gocmd/helmfile/destroy.gocmd/helmfile/diff.gocmd/helmfile/generate/generate.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/helmfile_test.gocmd/helmfile/sync.gocmd/helmfile/utils.gocmd/helmfile/version.gocmd/helmfile_generate_varfile.gocmd/root.goerrors/errors.gopkg/helmfile/auth.gotests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.goldentests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldenwebsite/blog/2025-01-15-helmfile-eks-modernization.mdx
💤 Files with no reviewable changes (3)
- cmd/helmfile.go
- cmd/aws.go
- cmd/helmfile_generate_varfile.go
✅ Files skipped from review due to trivial changes (3)
- tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden
- cmd/helmfile/destroy.go
🚧 Files skipped from review as they are similar to previous changes (2)
- errors/errors.go
- pkg/helmfile/auth.go
🧰 Additional context used
📓 Path-based instructions (6)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
website/blog/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
website/blog/**/*.mdx: Follow PR template (what/why/references); PRs labeled minor/major MUST include blog post at website/blog/YYYY-MM-DD-feature-name.mdx with YAML front matter, after intro, and only tags from website/blog/tags.yml
Blog posts MUST use only tags defined in website/blog/tags.yml and authors defined in website/blog/authors.yml; valid tags are: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core; never invent new tags
Files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
cmd/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
cmd/**/*.go: Use Cobra's recommended command structure with a root command and subcommands, implementing each command in a separate file undercmd/directory
Provide comprehensive help text for all commands and flags, include examples in command help, and follow Go's documentation conventions in Cobra command definitions
Provide meaningful feedback to users and include progress indicators for long-running operations in CLI commands
cmd/**/*.go: Commands MUST use flags.NewStandardParser() for command-specific flags; NEVER call viper.BindEnv() or viper.BindPFlag() directly (Forbidigo enforces this); see cmd/version/version.go for reference
Embed CLI examples from cmd/markdown/*_usage.md using //go:embed; render with utils.PrintfMarkdown()
Files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/aws/eks/update_kubeconfig_test.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: NEVER use fmt.Fprintf(os.Stdout/Stderr) or fmt.Println(); use data.* or ui.* functions instead
All comments must end with periods (enforced by godot linter)
Organize imports in three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages; maintain aliases: cfg, log, u, errUtils
Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions for performance tracking; use nil if no atmosConfig param
All errors MUST be wrapped using static errors defined in errors/errors.go; use errors.Join for combining multiple errors; use fmt.Errorf with %w for adding string context; use error builder for complex errors; use errors.Is() for error checking; NEVER use dynamic errors directly
Use go.uber.org/mock/mockgen with //go:generate directives for mock generation; never create manual mocks
Keep files small...
Files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/aws/eks/update_kubeconfig_test.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
**/*_test.go: Prefer unit tests with mocks over integration tests; use interfaces + dependency injection for testability; generate mocks with go.uber.org/mock/mockgen; use table-driven tests; target >80% coverage
Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking
Files:
cmd/helmfile/helmfile_test.gocmd/aws/eks/update_kubeconfig_test.go
cmd/**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
ALWAYS use cmd.NewTestKit(t) for cmd tests to auto-clean RootCmd state (flags, args)
Files:
cmd/helmfile/helmfile_test.gocmd/aws/eks/update_kubeconfig_test.go
🧠 Learnings (55)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
📚 Learning: 2025-11-29T17:35:01.177Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1819
File: website/blog/2025-10-13-introducing-atmos-auth.md:5-6
Timestamp: 2025-11-29T17:35:01.177Z
Learning: In the Atmos blog (website/blog/), blog post authors should be set to the actual content author (the person who wrote the feature/content), not generic organization names like "cloudposse" or "atmos". If the actual author differs from the PR opener, use the actual author. Authors must exist in website/blog/authors.yml.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to website/blog/**/*.mdx : Blog posts MUST use only tags defined in website/blog/tags.yml and authors defined in website/blog/authors.yml; valid tags are: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core; never invent new tags
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-12-13T06:07:37.766Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:37.766Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdxtests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdxcmd/root.go
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdxtests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden
📚 Learning: 2025-01-17T00:18:57.769Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-11-01T20:24:29.557Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1714
File: NOTICE:0-0
Timestamp: 2025-11-01T20:24:29.557Z
Learning: In the cloudposse/atmos repository, the NOTICE file is programmatically generated and should not be manually edited. Issues with dependency license URLs in NOTICE will be resolved when upstream package metadata is corrected.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to website/blog/**/*.mdx : Follow PR template (what/why/references); PRs labeled minor/major MUST include blog post at website/blog/YYYY-MM-DD-feature-name.mdx with YAML front matter, <!--truncate--> after intro, and only tags from website/blog/tags.yml
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdx
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
Applied to files:
website/blog/2025-01-15-helmfile-eks-modernization.mdxcmd/helmfile/helmfile_test.gotests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldencmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
cmd/root.gocmd/helmfile/sync.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
cmd/root.gocmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/helmfile/utils.gotests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldencmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*.go : Organize imports in three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages; maintain aliases: cfg, log, u, errUtils
Applied to files:
cmd/root.gocmd/helmfile/apply.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-12-13T04:37:25.223Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: cmd/root.go:0-0
Timestamp: 2025-12-13T04:37:25.223Z
Learning: In Atmos cmd/root.go Execute(), after cfg.InitCliConfig, we must call both toolchainCmd.SetAtmosConfig(&atmosConfig) and toolchain.SetAtmosConfig(&atmosConfig) so the CLI wrapper and the toolchain package receive configuration; missing either can cause nil-pointer panics in toolchain path resolution.
Applied to files:
cmd/root.go
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/utils.gotests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldencmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-12-21T04:10:29.030Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: internal/exec/describe_affected.go:468-468
Timestamp: 2025-12-21T04:10:29.030Z
Learning: In Go, package-level declarations (constants, variables, types, and functions) are visible to all files in the same package without imports. During reviews in cloudposse/atmos (and similar Go codebases), before suggesting to declare a new identifier, first check if it already exists in another file of the same package. If it exists, you can avoid adding a new declaration; if not, proceed with a proper package-level declaration.
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/aws/eks/update_kubeconfig_test.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Use Cobra's recommended command structure with a root command and subcommands, implementing each command in a separate file under `cmd/` directory
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
cmd/root.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/helmfile/helmfile.go
📚 Learning: 2025-01-30T19:30:59.120Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.
Applied to files:
cmd/root.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/diff.go
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
cmd/root.gocmd/helmfile/sync.go
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/utils.gotests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldencmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-12-13T04:37:40.435Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: cmd/toolchain/get.go:23-40
Timestamp: 2025-12-13T04:37:40.435Z
Learning: In Go CLI command files using Cobra, constrain the subcommand to accept at most one positional argument (MaximumNArgs(1)) so it supports both listing all items (zero args) and fetching a specific item (one arg). Define and parse flags with a standard parser (e.g., flags.NewStandardParser()) and avoid binding flags to Viper (no viper.BindEnv/BindPFlag). This promotes explicit argument handling and predictable flag behavior across command files.
Applied to files:
cmd/root.gocmd/aws/aws.gocmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/aws/eks/update_kubeconfig_test.gocmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/aws/eks/update_kubeconfig.gocmd/helmfile/diff.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Provide comprehensive help text for all commands and flags, include examples in command help, and follow Go's documentation conventions in Cobra command definitions
Applied to files:
cmd/aws/aws.gocmd/helmfile/version.gocmd/aws/eks/eks.gocmd/helmfile/utils.gocmd/helmfile/apply.gocmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.gocmd/helmfile/generate/generate.gocmd/helmfile/diff.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Use registry pattern for extensibility with CommandProvider interface for new commands; all commands MUST use command registry pattern per docs/prd/command-registry-pattern.md
Applied to files:
cmd/aws/aws.go
📚 Learning: 2025-12-10T18:32:43.260Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1808
File: cmd/terraform/backend/backend_delete_test.go:9-23
Timestamp: 2025-12-10T18:32:43.260Z
Learning: In cmd subpackages, tests should avoid using NewTestKit(t) unless tests actually interact with RootCmd (e.g., execute commands via RootCmd or modify RootCmd state). For structural tests that only verify command structure/flags without touching RootCmd, TestKit cleanup is unnecessary.
Applied to files:
cmd/helmfile/helmfile_test.gocmd/aws/eks/update_kubeconfig_test.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*_test.go : Test behavior, not implementation; never test stub functions; avoid tautological tests; make code testable via DI; no coverage theater; remove always-skipped tests; use errors.Is() for error checking
Applied to files:
cmd/helmfile/helmfile_test.gocmd/aws/eks/update_kubeconfig_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
Applied to files:
cmd/helmfile/helmfile_test.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to **/*.go : Keep files small and focused (<600 lines); one cmd/impl per file; co-locate tests; never use //revive:disable:file-length-limit
Applied to files:
cmd/helmfile/helmfile_test.gocmd/helmfile/version.gocmd/helmfile/utils.gocmd/helmfile/apply.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.
Applied to files:
cmd/helmfile/helmfile_test.go
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
cmd/helmfile/helmfile_test.gocmd/helmfile/utils.go
📚 Learning: 2025-05-23T19:51:47.091Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.
Applied to files:
cmd/helmfile/helmfile_test.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
cmd/helmfile/helmfile_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
cmd/helmfile/helmfile_test.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to cmd/**/*.go : Commands MUST use flags.NewStandardParser() for command-specific flags; NEVER call viper.BindEnv() or viper.BindPFlag() directly (Forbidigo enforces this); see cmd/version/version.go for reference
Applied to files:
cmd/helmfile/version.go
📚 Learning: 2025-12-10T18:32:51.237Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1808
File: cmd/terraform/backend/backend_delete_test.go:9-23
Timestamp: 2025-12-10T18:32:51.237Z
Learning: In cmd subpackages (e.g., cmd/terraform/backend/), tests cannot use cmd.NewTestKit(t) due to Go's test visibility rules (NewTestKit is in a parent package test file). These tests only need TestKit if they execute commands through RootCmd or modify RootCmd state. Structural tests that only verify command structure/flags without touching RootCmd don't require TestKit cleanup.
Applied to files:
cmd/aws/eks/eks.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
cmd/aws/eks/eks.gocmd/helmfile/utils.go
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to cmd/**/*.go : Embed CLI examples from cmd/markdown/*_usage.md using //go:embed; render with utils.PrintfMarkdown()
Applied to files:
cmd/helmfile/utils.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Provide meaningful feedback to users and include progress indicators for long-running operations in CLI commands
Applied to files:
cmd/helmfile/utils.gocmd/helmfile/apply.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
Applied to files:
cmd/helmfile/utils.go
📚 Learning: 2025-12-13T03:21:35.786Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:35.786Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
cmd/helmfile/utils.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-02-09T14:38:53.443Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/cmd_utils.go:0-0
Timestamp: 2025-02-09T14:38:53.443Z
Learning: Error handling for RegisterFlagCompletionFunc in AddStackCompletion is not required as the errors are non-critical for tab completion functionality.
Applied to files:
cmd/helmfile/utils.go
📚 Learning: 2025-01-07T20:38:09.618Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 896
File: cmd/editor_config.go:37-40
Timestamp: 2025-01-07T20:38:09.618Z
Learning: Error handling suggestion for `cmd.Help()` in `cmd/editor_config.go` was deferred as the code is planned for future modifications.
Applied to files:
cmd/helmfile/utils.go
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
tests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.goldencmd/helmfile/generate/varfile.go
📚 Learning: 2025-10-11T19:12:38.832Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: tests/snapshots/TestCLICommands_atmos_workflow_invalid_step_type.stderr.golden:0-0
Timestamp: 2025-10-11T19:12:38.832Z
Learning: Usage Examples sections in error output are appropriate for command usage errors (incorrect syntax, missing arguments, invalid flags) but not for configuration validation errors (malformed workflow files, invalid settings in atmos.yaml). Configuration errors should focus on explaining what's wrong with the config, not command usage patterns.
Applied to files:
tests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to cmd/**/*_test.go : ALWAYS use cmd.NewTestKit(t) for cmd tests to auto-clean RootCmd state (flags, args)
Applied to files:
cmd/aws/eks/update_kubeconfig_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Follow standard Go coding style: use `gofmt` and `goimports` to format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Applied to files:
cmd/helmfile/apply.gocmd/helmfile/helmfile.go
📚 Learning: 2025-01-09T22:22:00.539Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/helmfile_destroy.go:6-15
Timestamp: 2025-01-09T22:22:00.539Z
Learning: Usage commands should not be added to helmfile subcommands (destroy, apply, sync, diff) as the usage is handled by the parent helmfile command.
Applied to files:
cmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/helmfile.gocmd/helmfile/diff.go
📚 Learning: 2025-01-18T15:15:41.645Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform.go:37-46
Timestamp: 2025-01-18T15:15:41.645Z
Learning: In the atmos CLI, error handling is intentionally structured to use LogErrorAndExit for consistent error display, avoiding Cobra's default error handling to prevent duplicate error messages.
Applied to files:
cmd/helmfile/apply.gocmd/helmfile/diff.go
📚 Learning: 2024-10-20T13:12:46.499Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.
Applied to files:
cmd/helmfile/apply.gocmd/helmfile/sync.gocmd/helmfile/diff.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
cmd/helmfile/apply.gocmd/helmfile/sync.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Use Viper for managing configuration, environment variables, and flags in CLI commands
Applied to files:
cmd/helmfile/generate/varfile.gocmd/helmfile/helmfile.go
🧬 Code graph analysis (3)
cmd/helmfile/utils.go (6)
pkg/schema/schema.go (1)
ConfigAndStacksInfo(670-767)internal/exec/cli_utils.go (1)
ProcessCommandLineArgs(81-203)pkg/config/config.go (1)
InitCliConfig(28-67)errors/errors.go (6)
ErrPathResolutionFailed(657-657)ErrAmbiguousComponentPath(659-659)ErrComponentNotInStack(656-656)ErrStackNotFound(467-467)ErrUserAborted(550-550)ErrComponentTypeMismatch(655-655)internal/exec/component_resolver.go (1)
ResolveComponentFromPath(18-27)pkg/logger/log.go (1)
Debug(24-26)
cmd/helmfile/generate/varfile.go (3)
internal/exec/helmfile_generate_varfile.go (1)
ExecuteHelmfileGenerateVarfileCmd(16-87)errors/error_funcs.go (1)
CheckErrorPrintAndExit(318-360)cmd/helmfile/generate/generate.go (1)
GenerateCmd(6-12)
cmd/aws/eks/update_kubeconfig.go (3)
pkg/perf/perf.go (1)
Track(121-138)internal/exec/aws_eks_update_kubeconfig.go (1)
ExecuteAwsEksUpdateKubeconfigCommand(17-86)cmd/aws/eks/eks.go (1)
EksCmd(6-17)
🪛 LanguageTool
website/blog/2025-01-15-helmfile-eks-modernization.mdx
[typographical] ~102-~102: To join two clauses or introduce examples, consider using an em dash.
Context: ...when used: - helm_aws_profile_pattern - Use --identity flag instead - `cluster...
(DASH_RULE)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Summary
🔇 Additional comments (29)
cmd/helmfile/version.go (1)
1-3: Package refactor looks solid.The shift from
package cmdtopackage helmfilealigns with the command registry refactor. BothhelmfileCmdandhelmfileRunexist in the helmfile package as expected, and the version command properly delegates tohelmfileRun.website/blog/2025-01-15-helmfile-eks-modernization.mdx (1)
1-109: Content structure and accuracy look solid.The blog post follows coding guidelines with proper front matter, valid tags, truncate marker placement, and clear migration examples. Content accurately reflects the PR objectives including EKS opt-in, identity-based auth, cluster name templates, and deprecation notices. Go template syntax is correct.
cmd/helmfile/utils.go (7)
1-16: Clean import organization.The three-group structure and alias conventions are correct. All dependencies are appropriately scoped.
28-38: Solid help handling.Performance tracking is in place, and the error from
cmd.Help()is correctly ignored per established patterns.
40-50: Heatmap detection works correctly.Scanning
os.Argsdirectly is the right approach here to catch the flag before formal parsing.
52-80: Well-structured config resolution.The double-dash handling splits Atmos flags from helmfile-native arguments correctly, and path resolution is properly gated.
82-116: Path resolution logic is solid.Calling
InitCliConfigwithprocessStacks=trueenables proper validation, and the resolver correctly detects type mismatches. The info struct update is clean.
118-135: Smart error handling strategy.Returning detailed errors unchanged and wrapping generic ones with hints gives users actionable feedback.
137-151: Stack completion wiring is correct.The flag registration follows the pattern, and the placeholder completion returns the appropriate directive. The comment on line 149 documents the future work clearly.
cmd/helmfile/apply.go (3)
1-1: Package rename aligns with refactor objectives.Moving from
cmdtohelmfilepackage follows the command registry pattern mentioned in the PR objectives. Good structural improvement.
3-3: Import organization looks good.Single import is appropriately formatted. No concerns here.
16-30: Command structure follows Cobra patterns correctly.The subcommand properly delegates to
helmfileRunand usesFParseErrWhitelistto allow helmfile-specific flags to pass through. Initialization correctly registers with the parent command. No command-specific flags are defined in this file, which aligns with the learning that helmfile subcommands inherit flags from their parent command.cmd/helmfile/diff.go (3)
1-3: Package migration looks clean.The move from
package cmdtopackage helmfilealigns with the command registry refactor described in the PR objectives. Import is minimal and appropriate.
28-30: Init registration follows Cobra's subcommand pattern correctly.The subcommand
helmfileDiffCmdis properly registered to its parent commandhelmfileCmd(defined incmd/helmfile/helmfile.go).
5-26: Command structure and helmfileRun implementation verified.The helmfileRun function correctly delegates to internal/exec.ExecuteHelmfile, which implements the full cluster name resolution chain: CLI flag → cluster_name → cluster_name_template → cluster_name_pattern (deprecated). The implementation includes proper deprecation warnings and handles EKS configuration as intended.
cmd/helmfile/sync.go (1)
1-30: LGTM! Package reorganization and comment improvements.The package rename to
helmfileand the updated comments (with proper periods) align with the new command structure. The comment on line 16 now accurately describes this as the sync subcommand rather than the base command.cmd/aws/aws.go (4)
1-14: LGTM! Proper package structure and imports.Import organization follows the three-group pattern, and the
doubleDashHintconstant follows the established pattern used across other tool commands (terraform, helmfile, etc.).
15-22: LGTM! Proper Cobra command structure.The AWS command definition follows Cobra best practices with comprehensive help text, appropriate flag parsing configuration, and correct argument constraints for a parent command.
24-32: LGTM! Proper command initialization and registration.The init function correctly wires the EKS subcommand and registers with the command registry. The hint flag follows the established pattern used across tool commands.
34-70: LGTM! Complete CommandProvider implementation.The provider implements all required interface methods with proper documentation. Nil returns are appropriately documented, and the "Cloud Integration" group provides clear categorization.
cmd/root.go (1)
52-55: LGTM! Side-effect imports for command registration.The new blank imports for AWS and Helmfile commands follow the established pattern for command registration via init() side effects, consistent with other built-in commands.
cmd/helmfile/generate/varfile.go (1)
1-17: LGTM! Proper command structure and delegation.The command definition follows Cobra best practices with comprehensive help text and correct RunE delegation to the execution function. Import organization follows guidelines.
cmd/aws/eks/eks.go (1)
1-17: LGTM! Package reorganization for command registry pattern.The package rename to
eks, variable export (EksCmd), and removal of auto-registration align with the new command provider pattern where the parent AWS command (cmd/aws/aws.go) wires the subcommand.cmd/helmfile/helmfile_test.go (1)
1-37: LGTM! Proper test guards and path adjustments.The addition of
skipIfHelmfileNotInstalledensures tests don't fail when helmfile isn't installed, and the fixture path adjustment correctly reflects the new test location. The helper properly usest.Helper()per Go testing conventions.cmd/helmfile/generate/generate.go (1)
1-12: LGTM! Package reorganization for subcommand structure.The package rename to
generate, variable export (GenerateCmd), and removal of auto-registration follow the new pattern where the parent helmfile command wires subcommands explicitly.cmd/helmfile/helmfile.go (3)
1-24: LGTM! Proper command structure with pass-through flag parsing.The helmfile command definition follows Cobra best practices. The
FParseErrWhitelist.UnknownFlags=truecorrectly allows unknown flags to pass through to helmfile while still parsing known Atmos flags.
26-38: LGTM! Proper initialization and registration.The init function correctly configures the command, adds the generate subcommand, and registers with the command registry. The comment explaining
FParseErrWhitelistvsDisableFlagParsingis helpful.
59-95: LGTM! Complete CommandProvider implementation.The provider implements all required interface methods with proper documentation. Nil returns are appropriately documented, and the "Core Stack Commands" group provides clear categorization.
tests/snapshots/TestCLICommands_helmfile_command_with_terraform_component_path.stderr.golden (1)
6-6: Clear and concise error message.The single-line format is a good improvement over the previous split message. Gets straight to the point.
793b441 to
11fcc56
Compare
|
Warning Release Documentation RequiredThis PR is labeled
|
…-be-optional-and-used-only-for Resolve conflict in helmfile snapshot by adopting main's indented bullet point format and including the source subcommand. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add missing import and registration of helmfile source subcommand - Fix broken links from /blog/ to /changelog/ (blog routeBasePath is 'changelog') Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update golden snapshots to include the new 'source' subcommand that was added in the previous commit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-be-optional-and-used-only-for Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
…-be-optional-and-used-only-for Resolve merge conflicts: - packer_output.go: Use main's more descriptive error message - Snapshot files: Take main's version with updated schema Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…D links - Regenerate golden snapshots to include cluster_name_template and cluster_name fields - Fix broken relative links in migration guide PRD to use absolute URLs - Affected tests: describe_config, describe_component vpc/mock Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-be-optional-and-used-only-for Resolved merge conflict in website/src/data/roadmap.js: - Kept EKS kubeconfig and cluster name configuration milestones from this branch (PR 1903) - Updated status to 'in-progress' since PR is not yet merged - Kept ECR milestone from main with featured category - Added AWS_REGION export milestone from main (PR 1955) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tests for HelmfileCommandProvider interface methods - Add tests for helmfile command subcommand registration and flags - Add tests for helmfileRun help request handling - Add tests for AWS EKS update-kubeconfig command flags and validation - Add tests for profile/role-arn mutual exclusivity - Add tests for helmfile path utilities (varfile name, varfile path, working dir) - Add tests for GetStackNamePattern function - Update snapshot for new cluster_name_template and cluster_name fields Coverage improvements: - cmd/aws/eks: 80.0% (meets target) - pkg/helmfile: 100% - cmd/helmfile: 72.8% Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@docs/prd/helmfile-use-eks-default-change.md`:
- Around line 125-128: The fenced code block containing the two WARN lines is
missing a language specifier (MD040); update the triple-backtick fence that
precedes the lines "WARN: helm_aws_profile_pattern is deprecated..." and "WARN:
cluster_name_pattern is deprecated..." to include a language hint such as text
or log (e.g., replace ``` with ```text) so the block is properly classified for
static analysis and rendering.
- Around line 81-100: The per-stack override example is missing the actual
override; update the example under the "components: helmfile: my-component:
settings:" block to include the explicit setting "use_eks: true" (or the
appropriate boolean) so users can see how to override the default at stack
level; specifically modify the sample in the stacks/prod.yaml snippet (the
helmfile my-component settings block) to show the concrete key/value instead of
just a comment.
In `@internal/exec/aws_eks_update_kubeconfig_test.go`:
- Around line 22-32: The test
TestExecuteAwsEksUpdateKubeconfig_RequiresClusterNameOrComponent currently fails
during config initialization (missing atmos.yaml) instead of exercising the
intended cluster-name/component validation in ExecuteAwsEksUpdateKubeconfig;
either (A) provide a minimal atmos.yaml fixture and any required config
initialization in the test so execution proceeds to the cluster-name/component
validation path and assert the specific validation error, or (B) if you intend
to test the config-init failure, rename the test to something like
TestExecuteAwsEksUpdateKubeconfig_FailsWithoutConfig and remove the redundant
assert.NotNil(t, err) (keep only assert.Error(t, err)). Ensure you reference the
ExecuteAwsEksUpdateKubeconfig call and the atmos.yaml setup when applying the
change.
🧹 Nitpick comments (6)
cmd/aws/eks/update_kubeconfig_test.go (1)
19-34:expectFlagis alwaystrue— consider simplifying.Every test case sets
expectFlag: true, so the conditional on line 39 never takes the false branch. You could drop the field and always assert non-nil, or add a negative case (e.g., a flag that should not exist) to justify the field.internal/exec/aws_eks_update_kubeconfig_test.go (1)
34-88: These assertions test the test data, not production code.Go's type system already guarantees struct field accessibility. The
NotEmptychecks and the Profile/RoleArn XOR logic here validate the hardcoded test literals, not any runtime behavior. This won't catch regressions.Consider replacing this with tests that actually invoke production code using these contexts — e.g., feeding them into the resolution/validation functions introduced in this PR. That way the struct values serve as meaningful inputs rather than self-referential checks.
internal/exec/helmfile.go (2)
285-285: Usefilepath.Joininstead of hardcoded/separator.Per coding guidelines, use
filepath.Join()for cross-platform path handling.- kubeconfigPath := fmt.Sprintf("%s/%s-kubecfg", atmosConfig.Components.Helmfile.KubeconfigPath, info.ContextPrefix) + kubeconfigPath := filepath.Join(atmosConfig.Components.Helmfile.KubeconfigPath, info.ContextPrefix+"-kubecfg")As per coding guidelines: "Use
filepath.Join()for cross-platform path handling instead of hardcoded path separators."
392-398: Potential duplicateKUBECONFIGenv var.When
UseEKSis true andKubeconfigPathis set,KUBECONFIGgets added twice: once at line 393 (from config) and again at line 319 (viaenvVarsEKSappended at line 397). The EKS-specific value wins because it appears later, which is likely correct — but consider guarding line 393 with!atmosConfig.Components.Helmfile.UseEKSto make the intent explicit and avoid a confusing duplicate.Suggested clarification
- if atmosConfig.Components.Helmfile.KubeconfigPath != "" { + if atmosConfig.Components.Helmfile.KubeconfigPath != "" && !atmosConfig.Components.Helmfile.UseEKS { envVars = append(envVars, fmt.Sprintf("KUBECONFIG=%s", atmosConfig.Components.Helmfile.KubeconfigPath)) }cmd/helmfile/helmfile_test.go (1)
20-38: Consider isolating subcommand RunE calls into subtests.Running all four
RunEcalls sequentially means a failure inapplymasks whetherdestroy/diff/syncalso fail correctly. Wrapping each int.Rungives independent pass/fail signals.Suggested approach
func TestHelmfileCommands_Error(t *testing.T) { skipIfHelmfileNotInstalled(t) stacksPath := "../../tests/fixtures/scenarios/stack-templates" t.Setenv("ATMOS_CLI_CONFIG_PATH", stacksPath) t.Setenv("ATMOS_BASE_PATH", stacksPath) - err := helmfileApplyCmd.RunE(helmfileApplyCmd, []string{}) - assert.Error(t, err, "helmfile apply command should return an error when called with no parameters") - - err = helmfileDestroyCmd.RunE(helmfileDestroyCmd, []string{}) - assert.Error(t, err, "helmfile destroy command should return an error when called with no parameters") - - err = helmfileDiffCmd.RunE(helmfileDiffCmd, []string{}) - assert.Error(t, err, "helmfile diff command should return an error when called with no parameters") - - err = helmfileSyncCmd.RunE(helmfileSyncCmd, []string{}) - assert.Error(t, err, "helmfile sync command should return an error when called with no parameters") + for _, tc := range []struct { + name string + cmd *cobra.Command + }{ + {"apply", helmfileApplyCmd}, + {"destroy", helmfileDestroyCmd}, + {"diff", helmfileDiffCmd}, + {"sync", helmfileSyncCmd}, + } { + t.Run(tc.name, func(t *testing.T) { + err := tc.cmd.RunE(tc.cmd, []string{}) + assert.Error(t, err, "helmfile %s should error with no parameters", tc.name) + }) + } }cmd/helmfile/utils_test.go (1)
237-243:TestEnableHeatmapIfRequestedonly checks for no panic.The comment explains why, and that's fair. Just noting this provides very low coverage of the actual logic. If the function grows, consider an approach that injects
os.Argsor extracts the logic into a testable helper.
CodeRabbit review fixes: - cmd/aws/eks: Simplify flag tests, add negative test cases for unexpected flags - cmd/helmfile: Refactor to table-driven subtests for independent pass/fail - internal/exec: Rename test to accurate name, replace self-referential tests - internal/exec/helmfile.go: Use filepath.Join for cross-platform paths - internal/exec/helmfile.go: Fix duplicate KUBECONFIG env var when UseEKS=true - docs/prd: Fix incomplete Option 3 example, add text language specifier Test coverage improvements: - Add TestGetConfigAndStacksInfo_DoubleDashSeparator (exercises double-dash parsing) - Add TestGetConfigAndStacksInfo_ErrorHandling - Add TestExecuteHelmfile_DisabledComponent - Add TestExecuteHelmfile_DeploySubcommand (deploy->sync conversion) - Add dry-run tests for AWS EKS update-kubeconfig Coverage results: - cmd/helmfile: 72.8% -> 75.3% - cmd/aws/eks: 80.0% (meets target) - getConfigAndStacksInfo: 57.1% -> 71.4% Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
These changes were released in v1.206.0-rc.5. |
what
use_eksdefault fromtruetofalsecluster_name_templatewith Go template syntax ({{ .vars.namespace }}-{{ .vars.stage }}-eks)cluster_nameconfig for explicit fixed cluster names--cluster-nameflag to override cluster name at runtimecluster_name_patternwith warning, recommendcluster_name_templatehelm_aws_profile_patternwith warning, recommend--identityflagwhy
These changes address DEV-2345 and DEV-2347 by modernizing the Helmfile EKS integration to be more flexible and align with Atmos's identity system. Users can now use helmfile with any Kubernetes cluster (not just EKS), have explicit control over cluster names, and use the standard
--identityflag for AWS authentication instead of custom pattern configurations.references
Closes DEV-2345, DEV-2347
Summary by CodeRabbit
New Features
--cluster-nameCLI flag andcluster_name_templatefor flexible EKS cluster naming--identityflag for AWS authentication supportConfiguration Changes
use_eksdefaults to falseDeprecations
helm_aws_profile_patterndeprecated; use--identityflag insteadcluster_name_patterndeprecated; usecluster_name_templateinstead