From 52b53e01f44d3cb880a8d8a153bab14975c6d8a8 Mon Sep 17 00:00:00 2001 From: Carter McKinnon Date: Fri, 28 Oct 2022 08:47:41 -0700 Subject: [PATCH 1/3] Install awscli v2 bundle when possible --- scripts/generate-version-info.sh | 1 + scripts/install-worker.sh | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/generate-version-info.sh b/scripts/generate-version-info.sh index 889a758ef..fb357408c 100644 --- a/scripts/generate-version-info.sh +++ b/scripts/generate-version-info.sh @@ -18,3 +18,4 @@ sudo rpm --query --all --queryformat '\{"%{NAME}": "%{VERSION}-%{RELEASE}"\}\n' # binaries echo $(jq ".binaries.kubelet = \"$(kubelet --version | awk '{print $2}')\"" $OUTPUT_FILE) > $OUTPUT_FILE +echo $(jq ".binaries.awscli = \"$(aws --version | awk '{print $1}' | cut -d '/' -f 1)\"" $OUTPUT_FILE) > $OUTPUT_FILE diff --git a/scripts/install-worker.sh b/scripts/install-worker.sh index da0de5789..a4667fe73 100644 --- a/scripts/install-worker.sh +++ b/scripts/install-worker.sh @@ -62,7 +62,6 @@ sudo yum update -y # Install necessary packages sudo yum install -y \ aws-cfn-bootstrap \ - awscli \ chrony \ conntrack \ curl \ @@ -118,6 +117,27 @@ sudo systemctl restart sshd.service sudo mkdir -p /etc/eks sudo mv $TEMPLATE_DIR/iptables-restore.service /etc/eks/iptables-restore.service +################################################################################ +### awscli ##################################################### +################################################################################ + +if [[ "$BINARY_BUCKET_REGION" != "us-iso-east-1" && "$BINARY_BUCKET_REGION" != "us-isob-east-1" ]]; then + # https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html + echo "Installing awscli v2 bundle" + AWSCLI_DIR=$(mktemp -d) + curl \ + --silent \ + --show-error \ + --retry 10 \ + --retry-delay 1 \ + -L "https://awscli.amazonaws.com/awscli-exe-linux-${MACHINE}.zip" -o "${AWSCLI_DIR}/awscliv2.zip" + unzip -q "${AWSCLI_DIR}/awscliv2.zip" -d ${AWSCLI_DIR} + sudo "${AWSCLI_DIR}/aws/install" +else + echo "Installing awscli package" + sudo yum install -y awscli +fi + ################################################################################ ### Docker ##################################################################### ################################################################################ From 5f497e88d7d620b062973d48a35694309562fe5f Mon Sep 17 00:00:00 2001 From: Carter McKinnon Date: Sat, 29 Oct 2022 08:48:27 -0700 Subject: [PATCH 2/3] Correct awscli version parsing --- scripts/generate-version-info.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/generate-version-info.sh b/scripts/generate-version-info.sh index fb357408c..f35243936 100644 --- a/scripts/generate-version-info.sh +++ b/scripts/generate-version-info.sh @@ -5,8 +5,7 @@ set -o errexit set -o pipefail -if [ "$#" -ne 1 ] -then +if [ "$#" -ne 1 ]; then echo "usage: $0 OUTPUT_FILE" exit 1 fi @@ -18,4 +17,4 @@ sudo rpm --query --all --queryformat '\{"%{NAME}": "%{VERSION}-%{RELEASE}"\}\n' # binaries echo $(jq ".binaries.kubelet = \"$(kubelet --version | awk '{print $2}')\"" $OUTPUT_FILE) > $OUTPUT_FILE -echo $(jq ".binaries.awscli = \"$(aws --version | awk '{print $1}' | cut -d '/' -f 1)\"" $OUTPUT_FILE) > $OUTPUT_FILE +echo $(jq ".binaries.awscli = \"$(aws --version | awk '{print $1}' | cut -d '/' -f 2)\"" $OUTPUT_FILE) > $OUTPUT_FILE From 6211b9513d170be57001038d6c9c9adbf017c97c Mon Sep 17 00:00:00 2001 From: Carter McKinnon Date: Wed, 9 Nov 2022 11:16:53 -0800 Subject: [PATCH 3/3] Apply formatting --- scripts/install-worker.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/install-worker.sh b/scripts/install-worker.sh index c7ddb0515..0b1bc8964 100644 --- a/scripts/install-worker.sh +++ b/scripts/install-worker.sh @@ -122,20 +122,20 @@ sudo mv $TEMPLATE_DIR/iptables-restore.service /etc/eks/iptables-restore.service ################################################################################ if [[ "$BINARY_BUCKET_REGION" != "us-iso-east-1" && "$BINARY_BUCKET_REGION" != "us-isob-east-1" ]]; then - # https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html - echo "Installing awscli v2 bundle" - AWSCLI_DIR=$(mktemp -d) - curl \ - --silent \ - --show-error \ - --retry 10 \ - --retry-delay 1 \ - -L "https://awscli.amazonaws.com/awscli-exe-linux-${MACHINE}.zip" -o "${AWSCLI_DIR}/awscliv2.zip" - unzip -q "${AWSCLI_DIR}/awscliv2.zip" -d ${AWSCLI_DIR} - sudo "${AWSCLI_DIR}/aws/install" + # https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html + echo "Installing awscli v2 bundle" + AWSCLI_DIR=$(mktemp -d) + curl \ + --silent \ + --show-error \ + --retry 10 \ + --retry-delay 1 \ + -L "https://awscli.amazonaws.com/awscli-exe-linux-${MACHINE}.zip" -o "${AWSCLI_DIR}/awscliv2.zip" + unzip -q "${AWSCLI_DIR}/awscliv2.zip" -d ${AWSCLI_DIR} + sudo "${AWSCLI_DIR}/aws/install" else - echo "Installing awscli package" - sudo yum install -y awscli + echo "Installing awscli package" + sudo yum install -y awscli fi ################################################################################