Fix set AWS_REGION alongside AWS_DEFAULT_REGION#1370
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1370 +/- ##
=======================================
Coverage 88.52% 88.52%
=======================================
Files 54 54
Lines 3649 3649
=======================================
Hits 3230 3230
Misses 289 289
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Owner
|
Thank you @gitfool ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #1336 was supposed to fix #1277 by managing
$AWS_REGIONalongside$AWS_DEFAULT_REGION, but the fix was incomplete. The unset path(
eval --clear) and the guard inGetDefaultRegionwere both updated tohandle
$AWS_REGION, and the docs were updated to say both variables aremanaged — but
execShellEnvs(the function that actually sets env vars foreval/exec/aws-sso-profile) was never updated to includeAWS_REGION.Reproduction:
Changes
cmd/aws-sso/exec_cmd.goexecShellEnvsinto a newsetRegionVars(shellVars map[string]string, region string)helper.setRegionVarsnow setsAWS_REGIONalongsideAWS_DEFAULT_REGIONandAWS_SSO_DEFAULT_REGIONwhen a region is configured.--no-region/-nflag help text to mentionAWS_REGION.cmd/aws-sso/exec_cmd_test.go(new file)TestSetRegionVarscovering both cases:AWS_DEFAULT_REGION,AWS_REGION,AWS_SSO_DEFAULT_REGION) are set to the configured valueAWS_SSO_DEFAULT_REGIONis clearedNo other changes required
eval --clear(eval_cmd.go)AWS_REGIONsettings.go)AWS_REGIONas fallbackFAQ.md,config.md)