Skip to content
Merged
57 changes: 56 additions & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,64 @@ jobs:
steps:
- aws-cli/install:
use_brew: true
integration-test-multiple-setups-reverse:
parameters:
executor:
type: executor
role_arn:
type: string
executor: <<parameters.executor>>
steps:
- aws-cli/setup:
profile_name: integration-test-multiple-setups-env
- run: |
aws sts get-caller-identity --profile integration-test-multiple-setups-env
- aws-cli/setup:
profile_name: integration-test-multiple-setups-oidc
role_arn: <<parameters.role_arn>>
- run: |
cat ~/.aws/config
cat ~/.aws/credentials
- run: |
aws sts get-caller-identity --profile integration-test-multiple-setups-oidc
integration-test-multiple-setups:
parameters:
executor:
type: executor
role_arn:
type: string
executor: <<parameters.executor>>
steps:
- aws-cli/setup:
set_aws_env_vars: false
profile_name: integration-test-multiple-setups-oidc
role_arn: <<parameters.role_arn>>
- run: |
aws sts get-caller-identity --profile integration-test-multiple-setups-oidc
- aws-cli/setup:
profile_name: integration-test-multiple-setups-env
- run: |
cat ~/.aws/config
cat ~/.aws/credentials
- run: |
aws sts get-caller-identity --profile integration-test-multiple-setups-env
workflows:
test-deploy:
jobs:
- integration-test-multiple-setups-reverse:
context: [CPE_ORBS_AWS]
role_arn: arn:aws:iam::122211685980:role/CPE_ECR_OIDC_TEST
matrix:
alias: integration-test-multiple-setups-reverse
parameters:
executor: [macos, linuxvm]
- integration-test-multiple-setups:
context: [CPE_ORBS_AWS]
role_arn: arn:aws:iam::122211685980:role/CPE_ECR_OIDC_TEST
matrix:
alias: integration-test-multiple-setups
parameters:
executor: [macos, linuxvm]
- integration-test-brew-install:
post-steps:
- check_aws_version
Expand Down Expand Up @@ -346,7 +401,7 @@ workflows:
pub_type: production
enable_pr_comment: true
context: orb-publisher
requires: [orb-tools/pack, test-install, test-install-version, test-install-override-version, integration-test-web-identity-with-profile, integration test web identity command with white spaces,integration-test-role-arn-config, test-install-override-version-with-latest, integration-test-skip-install-matched-version, integration-test-brew-install]
requires: [orb-tools/pack, test-install, test-install-version, test-install-override-version, integration-test-web-identity-with-profile, integration test web identity command with white spaces,integration-test-role-arn-config, test-install-override-version-with-latest, integration-test-skip-install-matched-version, integration-test-brew-install, integration-test-multiple-setups, integration-test-multiple-setups-reverse]
filters: *release-filters
executors:
terraform:
Expand Down
1 change: 1 addition & 0 deletions src/commands/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ steps:
- run:
name: Configure AWS Access Key ID
environment:
AWS_CLI_STR_ROLE_ARN: <<parameters.role_arn>>
AWS_CLI_STR_ACCESS_KEY_ID: <<parameters.aws_access_key_id>>
AWS_CLI_STR_SECRET_ACCESS_KEY: <<parameters.aws_secret_access_key>>
AWS_CLI_STR_PROFILE_NAME: <<parameters.profile_name>>
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ AWS_CLI_STR_SESSION_TOKEN="$(echo "$AWS_CLI_STR_SESSION_TOKEN" | circleci env su
AWS_CLI_STR_REGION="$(echo "$AWS_CLI_STR_REGION" | circleci env subst)"
AWS_CLI_STR_PROFILE_NAME="$(echo "$AWS_CLI_STR_PROFILE_NAME" | circleci env subst)"
AWS_CLI_BOOL_SET_AWS_ENV_VARS="$(echo "$AWS_CLI_BOOL_SET_AWS_ENV_VARS" | circleci env subst)"
AWS_CLI_STR_ROLE_ARN="$(echo "${AWS_CLI_STR_ROLE_ARN}" | circleci env subst)"

if [ -z "$AWS_CLI_STR_ACCESS_KEY_ID" ] && [ -z "${AWS_CLI_STR_SECRET_ACCESS_KEY}" ] && [ "$AWS_CLI_BOOL_SET_AWS_ENV_VARS" = 0 ]; then
if [ "$AWS_CLI_BOOL_SET_AWS_ENV_VARS" = 0 ]; then
temp_file="/tmp/${AWS_CLI_STR_PROFILE_NAME}.keys"
. "$temp_file"
else
touch "${BASH_ENV}"
. "${BASH_ENV}"
fi

aws configure set aws_access_key_id \
"$AWS_CLI_STR_ACCESS_KEY_ID" \
--profile "$AWS_CLI_STR_PROFILE_NAME"
Expand All @@ -23,7 +23,7 @@ aws configure set aws_secret_access_key \
"$AWS_CLI_STR_SECRET_ACCESS_KEY" \
--profile "$AWS_CLI_STR_PROFILE_NAME"

if [ -n "${AWS_CLI_STR_SESSION_TOKEN}" ]; then
if [ -n "${AWS_CLI_STR_ROLE_ARN}" ]; then
aws configure set aws_session_token \
"${AWS_CLI_STR_SESSION_TOKEN}" \
--profile "$AWS_CLI_STR_PROFILE_NAME"
Expand Down