Skip to content

Commit 1d1c165

Browse files
authored
chore(NODE-6502) Use a python venv wherever we use Python in driver CI (#4325)
1 parent e2a392b commit 1d1c165

7 files changed

+25
-11
lines changed

.evergreen/config.in.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ functions:
228228
# Get access to the AWS temporary credentials:
229229
echo "adding temporary AWS credentials to environment"
230230
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
231-
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
231+
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
232+
. ./activate-kmstlsvenv.sh
233+
. ./set-temp-creds.sh
234+
popd
232235
233236
MONGODB_URI="${MONGODB_URI}" \
234237
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \

.evergreen/config.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ functions:
199199
# Get access to the AWS temporary credentials:
200200
echo "adding temporary AWS credentials to environment"
201201
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
202-
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
202+
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
203+
. ./activate-kmstlsvenv.sh
204+
. ./set-temp-creds.sh
205+
popd
203206
204207
MONGODB_URI="${MONGODB_URI}" \
205208
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \

.evergreen/run-azure-kms-mock-server.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ if [ -z ${DRIVERS_TOOLS+omitted} ]; then echo "DRIVERS_TOOLS is unset" && exit 1
44

55
set -o errexit
66

7-
python3 $DRIVERS_TOOLS/.evergreen/csfle/bottle.py fake_azure:imds &
7+
pushd $DRIVERS_TOOLS/.evergreen/csfle
8+
. ./activate-kmstlsvenv.sh
9+
python bottle.py fake_azure:imds &
10+
popd
811

912
echo "Running Azure KMS idms server on port 8080"

.evergreen/run-custom-csfle-tests.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ set -o errexit # Exit the script with error if any of the commands fail
2020
# Get access to the AWS temporary credentials:
2121
echo "adding temporary AWS credentials to environment"
2222
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
23-
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
23+
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
24+
. ./activate-kmstlsvenv.sh
25+
. ./set-temp-creds.sh
26+
popd
2427

2528
ABS_PATH_TO_PATCH=$(pwd)
2629

.evergreen/run-socks5-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -o xtrace # For debuggability, no external credentials are used here
77

88
node -v
99

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

1212
# ssl setup
1313
SSL=${SSL:-nossl}

.evergreen/run-tests.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ if [[ -z "${CLIENT_ENCRYPTION}" ]]; then
4545
unset AWS_ACCESS_KEY_ID;
4646
unset AWS_SECRET_ACCESS_KEY;
4747
else
48-
pip install --upgrade boto3
48+
pushd "$DRIVERS_TOOLS/.evergreen/csfle"
49+
. ./activate-kmstlsvenv.sh
4950
# Get access to the AWS temporary credentials:
5051
echo "adding temporary AWS credentials to environment"
5152
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
52-
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
53+
source set-temp-creds.sh
54+
popd
5355
fi
5456

5557
npm install mongodb-client-encryption

test/readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,10 @@ The following steps will walk you through how to run the tests for CSFLE.
384384
385385
1. Set temporary AWS credentials
386386
387-
```
388-
pip3 install boto3
389-
PYTHON="python3" source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/set-temp-creds.sh
390-
```
387+
```
388+
source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/activate-kmstlsvenv.sh
389+
source /path/to/mongodb-labs/drivers-evergreen-tools/.evergreen/csfle/set-temp-creds.sh
390+
```
391391
392392
Alternatively for fish users the following script can be substituted for set-temp-creds.sh:
393393

0 commit comments

Comments
 (0)