Skip to content
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1
setup: true
orbs:
orb-tools: circleci/orb-tools@12.0
shellcheck: circleci/shellcheck@3.1
orb-tools: circleci/orb-tools@12.2
shellcheck: circleci/shellcheck@3.2

filters: &filters
tags:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ workflows:
matrix:
alias: test-install-version
parameters:
executor: ["docker-base", "macos", "alpine", "docker-nounset-shell" ]
executor: ["docker-base", "macos", "docker-nounset-shell" ]
version: "2.15.57"
filters: *filters
post-steps:
Expand Down
4 changes: 3 additions & 1 deletion src/commands/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ description: "Install the AWS CLI via Pip if not already installed."

parameters:
version:
description: Select a specific version of the AWS v2 CLI. By default the latest version will be used.
description: |
Select a specific version of the AWS v2 CLI. By default the latest version will be used.
This value is ignored on Alpine, and the default version on the repositories is installed.
default: latest
type: string
override_installed:
Expand Down
16 changes: 13 additions & 3 deletions src/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
AWS_CLI_STR_AWS_CLI_VERSION="$(echo "${AWS_CLI_STR_AWS_CLI_VERSION}" | circleci env subst)"
AWS_CLI_EVAL_INSTALL_DIR="$(eval echo "${AWS_CLI_EVAL_INSTALL_DIR}" | circleci env subst)"
AWS_CLI_EVAL_BINARY_DIR="$(eval echo "${AWS_CLI_EVAL_BINARY_DIR}" | circleci env subst)"
Expand Down Expand Up @@ -31,10 +31,20 @@ Toggle_Pager(){
fi
}

if [ "$AWS_CLI_STR_AWS_CLI_VERSION" = "latest" ]; then
# shellcheck disable=SC3040
set +o pipefail
CLI_COMPARISON_VERSION="$(wget -q -O - https://api.github.com/repos/aws/aws-cli/tags | grep '"name":' | head -n 1 | awk -F'"' '{print $4}')"
echo "Latest is: $CLI_COMPARISON_VERSION"
set -o pipefail
else
CLI_COMPARISON_VERSION="$AWS_CLI_STR_AWS_CLI_VERSION"
fi

if ! command -v aws >/dev/null 2>&1; then
Install_AWS_CLI "${AWS_CLI_STR_AWS_CLI_VERSION}"
elif aws --version | awk '{print $2}' |grep "${AWS_CLI_STR_AWS_CLI_VERSION}"; then
echo "AWS CLI version ${AWS_CLI_STR_AWS_CLI_VERSION} already installed. Skipping installation"
elif aws --version | awk '{print $2}' | grep "${CLI_COMPARISON_VERSION}"; then
echo "AWS CLI version ${CLI_COMPARISON_VERSION} already installed. Skipping installation"
exit 0
elif [ "$AWS_CLI_BOOL_OVERRIDE" -eq 1 ]; then
Uninstall_AWS_CLI
Expand Down