From eef0f915a675c73adb716af4810cb74c45f57e99 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 2 Jul 2024 17:06:23 -0500 Subject: [PATCH] fix handling of gcloud --- .evergreen/auth_oidc/k8s/setup.sh | 3 --- .../csfle/gcpkms/create-and-setup-instance.sh | 3 +-- .evergreen/csfle/gcpkms/download-gcloud.sh | 15 +++++++++++++++ .evergreen/ensure-binary.sh | 3 +-- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100755 .evergreen/csfle/gcpkms/download-gcloud.sh diff --git a/.evergreen/auth_oidc/k8s/setup.sh b/.evergreen/auth_oidc/k8s/setup.sh index 1ca6685a..3bfbb14d 100755 --- a/.evergreen/auth_oidc/k8s/setup.sh +++ b/.evergreen/auth_oidc/k8s/setup.sh @@ -10,9 +10,6 @@ pushd $SCRIPT_DIR rm -f secrets-export.sh . ./setup-secrets.sh -VARIANT=${VARIANT:-"aks"} -VARIANT=$(echo "$VARIANT" | tr '[:upper:]' '[:lower:]') - ######################## # Start an Atlas Cluster diff --git a/.evergreen/csfle/gcpkms/create-and-setup-instance.sh b/.evergreen/csfle/gcpkms/create-and-setup-instance.sh index 513d1484..db43c1ad 100755 --- a/.evergreen/csfle/gcpkms/create-and-setup-instance.sh +++ b/.evergreen/csfle/gcpkms/create-and-setup-instance.sh @@ -31,8 +31,7 @@ export GCPKMS_DISKSIZE=${GCPKMS_DISKSIZE:-"20gb"} # download-gcloud.sh sets GCPKMS_GCLOUD. echo "download-gcloud.sh ... begin" -bash $DRIVERS_TOOLS/.evergreen/ensure-binary.sh gcloud -export GCPKMS_GCLOUD=$(which gcloud) +. $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/download-gcloud.sh echo "download-gcloud.sh ... end" # Handle login. diff --git a/.evergreen/csfle/gcpkms/download-gcloud.sh b/.evergreen/csfle/gcpkms/download-gcloud.sh new file mode 100755 index 00000000..0328d4b9 --- /dev/null +++ b/.evergreen/csfle/gcpkms/download-gcloud.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Download gcloud CLI for Linux 64-bit (x86_64). +# Evergreen scripts must use the expansions.update command to load the expansion. +set -o errexit # Exit on first command error. + +if command -v gcloud &> /dev/null; then + echo "gcloud is on the path" + GCPKMS_GCLOUD=gcloud +else + echo "Download gcloud ... begin" + wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-393.0.0-linux-x86_64.tar.gz + tar xf google-cloud-cli-393.0.0-linux-x86_64.tar.gz + GCPKMS_GCLOUD=$(pwd)/google-cloud-sdk/bin/gcloud + echo "Download gcloud ... end" +fi diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 98dff54e..1a3e622d 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -46,8 +46,7 @@ case $NAME in BASE="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads" case "$OS_NAME-$MARCH" in linux-x86_64) - # Use 393.0.0 for compat with debian 10. - URL="$BASE/google-cloud-cli-393.0.0-linux-x86_64.tar.gz" + URL="$BASE/google-cloud-cli-linux-x86_64.tar.gz" ;; linux-aarch64) URL="$BASE/google-cloud-cli-linux-arm.tar.gz"