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

fix: install specified version #159

Merged
merged 4 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ workflows:
version: "2.1.10"
install_dir: "/usr/local/aws-cli"
binary_dir: ""
override_installed: true
override_installed: false
filters: *filters
post-steps:
- check_aws_version:
Expand Down
4 changes: 2 additions & 2 deletions src/commands/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ parameters:
the environment variable you will use to hold this
value, i.e. AWS_ACCESS_KEY.
type: string
default: ${AWS_ACCESS_KEY_ID}
default: AWS_ACCESS_KEY_ID

aws_secret_access_key:
description: |
AWS secret key for IAM role. Set this to the name of
the environment variable you will use to hold this
value, i.e. AWS_SECRET_ACCESS_KEY.
type: string
default: ${AWS_SECRET_ACCESS_KEY}
default: AWS_SECRET_ACCESS_KEY

region:
description: |
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/assume_role_with_web_identity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ AWS_CLI_STR_ROLE_ARN="$(echo "${AWS_CLI_STR_ROLE_ARN}" | circleci env subst)"
AWS_CLI_STR_PROFILE_NAME="$(echo "${AWS_CLI_STR_PROFILE_NAME}" | circleci env subst)"
AWS_CLI_STR_REGION="$(echo "${AWS_CLI_STR_REGION}" | circleci env subst)"


# Replaces white spaces in role session name with dashes
AWS_CLI_STR_ROLE_SESSION_NAME=$(echo "${AWS_CLI_STR_ROLE_SESSION_NAME}" | tr ' ' '-')

if [ -z "${AWS_CLI_STR_ROLE_SESSION_NAME}" ]; then
echo "Role session name is required"
exit 1
Expand Down Expand Up @@ -47,4 +47,4 @@ else
echo "export AWS_SESSION_TOKEN=\"${AWS_SESSION_TOKEN}\""
} >>"$BASH_ENV"
echo "Assume role with web identity succeeded"
fi
fi
7 changes: 3 additions & 4 deletions src/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if grep "Alpine" /etc/issue > /dev/null 2>&1; then
. "$BASH_ENV"
fi

AWS_CLI_STR_ACCESS_KEY_ID="$(echo "$AWS_CLI_STR_ACCESS_KEY_ID" | circleci env subst)"
AWS_CLI_STR_SECRET_ACCESS_KEY="$(echo "$AWS_CLI_STR_SECRET_ACCESS_KEY" | circleci env subst)"
AWS_CLI_STR_ACCESS_KEY_ID="$(echo "\$$AWS_CLI_STR_ACCESS_KEY_ID" | circleci env subst)"
AWS_CLI_STR_SECRET_ACCESS_KEY="$(echo "\$$AWS_CLI_STR_SECRET_ACCESS_KEY" | circleci env subst)"
AWS_SESSION_TOKEN="$(echo "$AWS_SESSION_TOKEN" | circleci env subst)"
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)"
Expand All @@ -15,7 +15,7 @@ if [ -z "$AWS_CLI_STR_ACCESS_KEY_ID" ] || [ -z "${AWS_CLI_STR_SECRET_ACCESS_KEY}
echo "Cannot configure profile. AWS access key id and AWS secret access key must be provided."
exit 1
fi
set -x

aws configure set aws_access_key_id \
"$AWS_CLI_STR_ACCESS_KEY_ID" \
--profile "$AWS_CLI_STR_PROFILE_NAME"
Expand All @@ -39,4 +39,3 @@ if [ "$AWS_CLI_BOOL_CONFIG_PROFILE_REGION" -eq "1" ]; then
aws configure set region "$AWS_CLI_STR_REGION" \
--profile "$AWS_CLI_STR_PROFILE_NAME"
fi
set +x
2 changes: 1 addition & 1 deletion src/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Toggle_Pager(){
if ! command -v aws >/dev/null 2>&1; then
Install_AWS_CLI "${AWS_CLI_STR_AWS_CLI_VERSION}"
Toggle_Pager
elif [ "$AWS_CLI_BOOL_OVERRIDE" -eq 1 ]; then
elif [ "$AWS_CLI_BOOL_OVERRIDE" -eq 1 ] || [ "${AWS_CLI_STR_AWS_CLI_VERSION}" != "latest" ]; then
Uninstall_AWS_CLI
Install_AWS_CLI "${AWS_CLI_STR_AWS_CLI_VERSION}"
Toggle_Pager
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/role_arn_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ ! -f "${HOME}/.aws/credentials" ]; then
echo "Credentials not found. Run setup command before role-arn-setup."
exit 1
fi
set -x

aws configure set profile."${AWS_CLI_STR_PROFILE_NAME}".role_arn "${AWS_CLI_STR_ROLE_ARN}"
aws configure set profile."${AWS_CLI_STR_PROFILE_NAME}".source_profile "${AWS_CLI_STR_SOURCE_PROFILE}"
set +x