Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(toolbox): use AWS_PROFILE/AWS_REGION if set when calling awsi.sh #5041

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

fnichol
Copy link
Contributor

@fnichol fnichol commented Nov 29, 2024

This change conditionally propagates the following local environment variables into the systeminit/toolbox container:

  • AWS_PROFILE
  • AWS_REGION

If either of these variables are not present they do not get added to the docker run command.

In order to confirm the behavior change, several other updates are included:

  • Add set -eu resulting in the shell script aborting if an expected environment variable is not set. To preserve the error message when you aren't authenticated, the existing AWS_* credential variables are still passed in as empty if not set.
  • Add a DEBUG and TRACE mode to the script which add set -v and set- xv respectively when running the shell script. This helps to understand the final docker run command that is about to be executed (among other branching logic).

This change conditionally propagates the following local environment
variables into the `systeminit/toolbox` container:

- `AWS_PROFILE`
- `AWS_REGION`

If either of these variables are not present they do not get added to
the `docker run` command.

In order to confirm the behavior change, several other updates are
included:

- Add `set -eu` resulting in the shell script aborting if an expected
  environment variable is not set. To preserve the error message when
  you aren't authenticated, the existing `AWS_*` credential variables
  are still passed in as empty if not set.
- Add a `DEBUG` and `TRACE` mode to the script which add `set -v` and
  `set- xv` respectively when running the shell script. This helps to
  understand the final `docker run` command that is about to be executed
  (among other branching logic).

Signed-off-by: Fletcher Nichol <[email protected]>
@fnichol fnichol added this pull request to the merge queue Nov 29, 2024
Merged via the queue into main with commit 654d7c0 Nov 29, 2024
8 checks passed
@fnichol fnichol deleted the fnichol/awsi-profile-region-env-vars branch November 29, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants