From 5048cca80e9ca62642409de2d401058bbd7057fa Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 4 Dec 2024 07:23:19 -0600 Subject: [PATCH] DRIVERS-3063 Use self-contained python binary (#560) --- .evergreen/auth_aws/teardown.sh | 9 +++++++-- .evergreen/find-python3.sh | 4 ++-- .evergreen/setup.sh | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.evergreen/auth_aws/teardown.sh b/.evergreen/auth_aws/teardown.sh index 963b7e18..449c3553 100755 --- a/.evergreen/auth_aws/teardown.sh +++ b/.evergreen/auth_aws/teardown.sh @@ -6,6 +6,11 @@ SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) . $SCRIPT_DIR/../handle-paths.sh pushd $SCRIPT_DIR -. ./activate-authawsvenv.sh -python ./lib/aws_assign_instance_profile.py + +# If we've gotten credentials, ensure the instance profile is set. +if [ -f secrets-export.sh ]; then + . ./activate-authawsvenv.sh + python ./lib/aws_assign_instance_profile.py +fi + popd diff --git a/.evergreen/find-python3.sh b/.evergreen/find-python3.sh index 91efb117..71863884 100755 --- a/.evergreen/find-python3.sh +++ b/.evergreen/find-python3.sh @@ -312,12 +312,12 @@ find_python3() ( # Diagnostic messages may be printed to stderr (pipe 2). Redirect to /dev/null # with `2>/dev/null` to silence these messages. # -# If PYTHON or PYTHON_BINARY are set, it will return that value. Otherwise +# If DRIVERS_TOOLS_PYTHON is set, it will return that value. Otherwise # it will use find_python3 to return a suitable value. # ensure_python3() { declare python_binary - python_binary="${PYTHON:-"${PYTHON_BINARY:-""}"}" + python_binary="${DRIVERS_TOOLS_PYTHON:-}" { if [ -z "${python_binary}" ]; then echo "Finding Python3 binary..." diff --git a/.evergreen/setup.sh b/.evergreen/setup.sh index d3bc7658..473ff52d 100755 --- a/.evergreen/setup.sh +++ b/.evergreen/setup.sh @@ -5,6 +5,7 @@ set -o errexit SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) . $SCRIPT_DIR/handle-paths.sh +. $SCRIPT_DIR/find-python3.sh # Ensure environment variables are set. if [[ -z "$PROJECT_DIRECTORY" ]]; then @@ -26,5 +27,9 @@ OS=${OS:-} PATH=$PATH EOF +# Set the python binary to use. +DRIVERS_TOOLS_PYTHON=$(find_python3 2>/dev/null) +echo "DRIVERS_TOOLS_PYTHON=$DRIVERS_TOOLS_PYTHON" >> $DRIVERS_TOOLS/.env + # Install the clis in this folder. bash $SCRIPT_DIR/install-cli.sh $SCRIPT_DIR