Skip to content

Commit

Permalink
change to use the same function
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 committed Jan 28, 2025
1 parent 3f637c9 commit 1a62fe7
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -553,30 +553,27 @@ function install_updatecli() {
function install_awscli() {
local archive_path download_url
archive_path=/tmp/awscli.zip
download_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWSCLI_VERSION}.zip"
if test "${ARCHITECTURE}" == "arm64"
then
download_url="https://awscli.amazonaws.com/awscli-exe-linux-aarch64-${AWSCLI_VERSION}.zip"
# check if a version argument is provided
if [ -n "$1" ]; then
local VERSION="$1"
else
# else use the AWSCLI_VERSION tracked with updatecli
local VERSION="${AWSCLI_VERSION}"
fi
curl --silent --location --show-error "${download_url}" --output "${archive_path}"
unzip "${archive_path}" -d /tmp
bash /tmp/aws/install
rm -rf /tmp/aws*
}
# https://github.com/jenkins-infra/packer-images/pull/1676 usage by directly calling /usr/local/aws-cli-${AWSCLI_PINNED_VERSION}/aws
function install_pinned_awscli() {
local archive_path download_url install_dir bin_dir
archive_path=/tmp/awscli.zip
download_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWSCLI_PINNED_VERSION}.zip"
install_dir="/usr/local/aws-cli-${AWSCLI_PINNED_VERSION}/"
bin_dir="${install_dir}"
download_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${VERSION}.zip"
if test "${ARCHITECTURE}" == "arm64"
then
download_url="https://awscli.amazonaws.com/awscli-exe-linux-aarch64-${AWSCLI_PINNED_VERSION}.zip"
download_url="https://awscli.amazonaws.com/awscli-exe-linux-aarch64-${VERSION}.zip"
fi
curl --silent --location --show-error "${download_url}" --output "${archive_path}"
unzip "${archive_path}" -d /tmp
bash /tmp/aws/install --install-dir "${install_dir}" --bin-dir "${bin_dir}"
if [ -n "$1" ]; then
local install_dir
install_dir="/usr/local/aws-cli-${VERSION}/"
bash /tmp/aws/install --install-dir "${install_dir}" --bin-dir "${install_dir}"
else
bash /tmp/aws/install
fi
rm -rf /tmp/aws*
}

Expand Down Expand Up @@ -740,7 +737,7 @@ function main() {
install_packer
install_updatecli
install_awscli
install_pinned_awscli
install_awscli "${AWSCLI_PINNED_VERSION}"
install_netlifydeploy
install_terraform
install_kubectl
Expand Down

0 comments on commit 1a62fe7

Please sign in to comment.