Skip to content

Commit

Permalink
chore(NODE-6502) Use a python venv wherever we use Python in driver CI (
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 13, 2024
1 parent e2a392b commit 1d1c165
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ functions:
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
. ./activate-kmstlsvenv.sh
. ./set-temp-creds.sh
popd
MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \
Expand Down
5 changes: 4 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ functions:
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
. ./activate-kmstlsvenv.sh
. ./set-temp-creds.sh
popd
MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \
Expand Down
5 changes: 4 additions & 1 deletion .evergreen/run-azure-kms-mock-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ if [ -z ${DRIVERS_TOOLS+omitted} ]; then echo "DRIVERS_TOOLS is unset" && exit 1

set -o errexit

python3 $DRIVERS_TOOLS/.evergreen/csfle/bottle.py fake_azure:imds &
pushd $DRIVERS_TOOLS/.evergreen/csfle
. ./activate-kmstlsvenv.sh
python bottle.py fake_azure:imds &
popd

echo "Running Azure KMS idms server on port 8080"
5 changes: 4 additions & 1 deletion .evergreen/run-custom-csfle-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ set -o errexit # Exit the script with error if any of the commands fail
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
. ./activate-kmstlsvenv.sh
. ./set-temp-creds.sh
popd

ABS_PATH_TO_PATCH=$(pwd)

Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-socks5-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -o xtrace # For debuggability, no external credentials are used here

node -v

PYTHON_BINARY=${PYTHON_BINARY:-python3}
PYTHON_BINARY=$(bash -c ". $DRIVERS_TOOLS/.evergreen/find-python3.sh && ensure_python3 2>/dev/null")

# ssl setup
SSL=${SSL:-nossl}
Expand Down
6 changes: 4 additions & 2 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ if [[ -z "${CLIENT_ENCRYPTION}" ]]; then
unset AWS_ACCESS_KEY_ID;
unset AWS_SECRET_ACCESS_KEY;
else
pip install --upgrade boto3
pushd "$DRIVERS_TOOLS/.evergreen/csfle"
. ./activate-kmstlsvenv.sh
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
source set-temp-creds.sh
popd
fi

npm install mongodb-client-encryption
Expand Down
8 changes: 4 additions & 4 deletions test/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ The following steps will walk you through how to run the tests for CSFLE.
1. Set temporary AWS credentials
```
pip3 install boto3
PYTHON="python3" source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/set-temp-creds.sh
```
```
source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/activate-kmstlsvenv.sh
source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/set-temp-creds.sh
```
Alternatively for fish users the following script can be substituted for set-temp-creds.sh:
Expand Down

0 comments on commit 1d1c165

Please sign in to comment.