Skip to content

test: add integration tests and troubleshooting guide for helm_aws_profile_pattern#2211

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-aws-profile-pattern-lookup
Open

test: add integration tests and troubleshooting guide for helm_aws_profile_pattern#2211
Copilot wants to merge 4 commits intomainfrom
copilot/fix-aws-profile-pattern-lookup

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

Users reported helm_aws_profile_pattern still being used after commenting it out in atmos.yaml. Investigation revealed the pattern can come from multiple sources beyond the config file, causing confusion.

Changes

  • internal/exec/helmfile_auth_integration_test.go — 5 integration tests covering:

    • Empty pattern falls back to ambient credentials
    • Set pattern is used with deprecation warning
    • --identity flag takes precedence over pattern
    • --identity=false behavior with and without pattern
  • TROUBLESHOOTING_HELM_AWS_PROFILE_PATTERN.md — Troubleshooting guide documenting:

    • Pattern source precedence (env var > config file > default)
    • How to identify which source is active
    • Steps to properly remove the pattern
    • Verification commands with debug logging

Root Cause

The pattern is not hardcoded. Default is empty string (""). Pattern comes from:

  1. ATMOS_COMPONENTS_HELMFILE_HELM_AWS_PROFILE_PATTERN env var (highest priority)
  2. components.helmfile.helm_aws_profile_pattern in atmos.yaml files (project/home/system paths)
  3. Default: "" (falls back to ambient credentials)

Users seeing the pattern after "commenting it out" likely have:

  • The env var set in their shell
  • Multiple atmos.yaml files (editing the wrong one)
  • Cached environment (didn't restart shell)

All tests pass, confirming the code correctly handles empty patterns by falling back to ambient credentials.

Original prompt

This section details on the original issue you should resolve

<issue_title>helm_aws_profile_pattern default cannot be disabled; no opt-out when migrating to --identity</issue_title>
<issue_description>### Describe the Bug

When helm_aws_profile_pattern is not set in atmos.yaml, Atmos applies a hardcoded default value ({namespace}-{tenant}-gbl-{stage}-helm) and attempts to resolve a matching AWS config profile. There is no way to opt out of this behavior.

The deprecation warning instructs users to use --identity instead, but passing --identity does not suppress the profile pattern lookup — the default is still evaluated and the command fails if no matching AWS config profile exists.

Expected Behavior

When a user omits helm_aws_profile_pattern and provides --identity, the deprecated profile lookup should be skipped entirely. The --identity flag should be a sufficient replacement with no additional configuration required.

Steps to Reproduce

  1. Omit helm_aws_profile_pattern from atmos.yaml (or remove it after seeing the deprecation warning)
  2. Run atmos helmfile diff -s --identity
  3. Observe the warning and error — Atmos resolves the default pattern {namespace}-{tenant}-gbl-{stage}-helm, fails to find the profile, and exits

Screenshots

No response

Environment

  • Atmos version: 1.207.0
  • OS: macOS (darwin/arm64)

Additional Context

Workaround: explicitly set helm_aws_profile_pattern to a pattern that matches an existing AWS config profile (e.g. {stage}-{region}). The --identity flag alone is not sufficient</issue_description>

<agent_instructions>Please investigate why this might be happening. This should have been refactored to work with the flag handler and command registry. Hopefully, there's a simple fix. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

@mergify mergify bot added triage Needs triage wip Work in Progress: Not ready for final review or merge labels Mar 16, 2026
@osterman osterman added the patch A minor, backward compatible change label Mar 16, 2026
…ws_profile_pattern configured

Co-authored-by: osterman <52489+osterman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix helm_aws_profile_pattern default behavior with --identity fix: allow helmfile EKS auth to fall back to ambient AWS credentials Mar 16, 2026
Copilot AI requested a review from osterman March 16, 2026 15:11
@mergify mergify bot removed the wip Work in Progress: Not ready for final review or merge label Mar 16, 2026
@github-actions github-actions bot added the size/s Small size PR label Mar 16, 2026
@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@osterman osterman marked this pull request as ready for review March 16, 2026 15:24
@osterman osterman requested a review from a team as a code owner March 16, 2026 15:24
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.41%. Comparing base (1f4ac96) to head (89dbe62).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2211      +/-   ##
==========================================
+ Coverage   77.40%   77.41%   +0.01%     
==========================================
  Files         962      962              
  Lines       91284    91288       +4     
==========================================
+ Hits        70657    70674      +17     
+ Misses      16550    16542       -8     
+ Partials     4077     4072       -5     
Flag Coverage Δ
unittests 77.41% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/helmfile/auth.go 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mikedizon
Copy link
Contributor

mikedizon commented Mar 17, 2026

@copilot

Test Report

Environment:

  • OS: macOS (darwin/arm64)
  • Command: atmos helmfile diff wiz-k8s -s tooling-us-gov-west-1 --use-version=2211
  • atmos.yaml has helm_aws_profile_pattern: "{stage}-{region}" set (the deprecated path)

Result:

✓ Switching to Atmos version 2211
 WARN  helm_aws_profile_pattern is deprecated, use --identity flag instead

The SSO session associated with this profile has expired or is otherwise invalid. To refresh this SSO session run aws sso login with the corresponding profile.

   Error

   Error: subcommand exited with code 255

Observation:
The deprecation warning is emitted as expected, but atmos still attempts to resolve and use the helm_aws_profile_pattern profile (tooling-us-gov-west-1). When the SSO session for that profile is expired, the command exits with code 255 with no actionable guidance beyond the raw AWS CLI error message.

This is not a fresh regression — the deprecated path still works when the SSO session is active. However, since the deprecation warning now tells users to switch to --identity, it would be helpful if passing --identity suppressed the profile pattern lookup entirely (i.e., the behavior described in issue #2188). Currently, even with this PR, a user who follows the deprecation warning and switches to --identity while still having helm_aws_profile_pattern in their config would likely still hit the profile resolution path.

@osterman
Copy link
Member

@copilot helm_aws_profile_pattern are we setting this in a default somewhere? Because if the user hasn't set it, this should not come up at all. In other words, this should be null by default and therefore not affect anything.

Copy link
Contributor Author

Copilot AI commented Mar 17, 2026

@osterman The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: ab9794de-4781-424a-9f21-7db04c985617

@osterman
Copy link
Member

@copilot helm_aws_profile_pattern are we setting this in a default somewhere? Because if the user hasn't set it, this should not come up at all. In other words, this should be null by default and therefore not affect anything.

Copy link
Contributor Author

Copilot AI commented Mar 17, 2026

@copilot helm_aws_profile_pattern are we setting this in a default somewhere? Because if the user hasn't set it, this should not come up at all. In other words, this should be null...

Correct! HelmAwsProfilePattern defaults to "" (empty string) in pkg/config/default.go:54. When it's empty, ResolveAWSAuth now falls through to ambient credentials (line 52 checks if input.ProfilePattern != "").

The issue description mentioned a "hardcoded default" but that appears to be a misunderstanding - the pattern {namespace}-{tenant}-gbl-{stage}-helm appears in the repo's own atmos.yaml (line 57) and test fixtures, but isn't a code default.

The fix ensures:

  1. Empty helm_aws_profile_pattern → ambient AWS credentials (no error)
  2. --identity=false → skips identity auth, falls through to pattern or ambient
  3. --identity <value> → uses identity auth as expected

Commit: 89dbe62

Copilot AI and others added 2 commits March 17, 2026 16:12
…avior

Co-authored-by: osterman <52489+osterman@users.noreply.github.com>
…ation

Co-authored-by: osterman <52489+osterman@users.noreply.github.com>
Copilot AI changed the title fix: allow helmfile EKS auth to fall back to ambient AWS credentials test: add integration tests and troubleshooting guide for helm_aws_profile_pattern Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/s Small size PR triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm_aws_profile_pattern default cannot be disabled; no opt-out when migrating to --identity

3 participants