@@ -207,13 +207,12 @@ functions:
207
207
script : |
208
208
set -o errexit
209
209
set -o pipefail
210
- cd drivers-evergreen-tools/.evergreen/orchestration
211
- if [ -f venv/bin/activate ]; then
212
- . venv/bin/activate
213
- elif [ -f venv/Scripts/activate ]; then
214
- . venv/Scripts/activate
210
+ if cd drivers-evergreen-tools/.evergreen/orchestration; then
211
+ . ../venv-utils.sh
212
+ if venvactivate venv; then
213
+ mongo-orchestration stop
214
+ fi
215
215
fi
216
- mongo-orchestration stop
217
216
218
217
" install_c_driver " :
219
218
- command : expansions.update
@@ -280,6 +279,30 @@ functions:
280
279
fi
281
280
282
281
" run_kms_servers " :
282
+ - command : shell.exec
283
+ params :
284
+ shell : bash
285
+ script : |-
286
+ set -o errexit
287
+ echo "Preparing CSFLE venv environment..."
288
+ cd ./drivers-evergreen-tools/.evergreen/csfle
289
+ # This function ensures future invocations of activate-kmstlsvenv.sh conducted in
290
+ # parallel do not race to setup a venv environment; it has already been prepared.
291
+ # This primarily addresses the situation where the "test" and "run_kms_servers"
292
+ # functions invoke 'activate-kmstlsvenv.sh' simultaneously.
293
+ if [[ "$OSTYPE" =~ cygwin && ! -d kmstlsvenv ]]; then
294
+ # Avoid using Python 3.10 on Windows due to incompatible cipher suites.
295
+ # See CXX-2628.
296
+ . ../venv-utils.sh
297
+ venvcreate "C:/python/Python39/python.exe" kmstlsvenv || # windows-2017
298
+ venvcreate "C:/python/Python38/python.exe" kmstlsvenv # windows-2015
299
+ python -m pip install --upgrade boto3~=1.19 pykmip~=0.10.0
300
+ deactivate
301
+ else
302
+ . ./activate-kmstlsvenv.sh
303
+ deactivate
304
+ fi
305
+ echo "Preparing CSFLE venv environment... done."
283
306
- command : shell.exec
284
307
params :
285
308
background : true
@@ -288,7 +311,7 @@ functions:
288
311
set -o errexit
289
312
echo "Starting mock KMS servers..."
290
313
cd ./drivers-evergreen-tools/.evergreen/csfle
291
- . ./activate_venv .sh
314
+ . ./activate-kmstlsvenv .sh
292
315
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
293
316
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
294
317
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &
@@ -326,21 +349,14 @@ functions:
326
349
fi
327
350
export CMAKE=${cmake}
328
351
329
- if [ "x$(lsb_release -cs)" = "xtrusty" -a -f /opt/mongodbtoolchain/v2/bin/python ]; then
330
- /opt/mongodbtoolchain/v2/bin/python -m virtualenv venv
331
- elif ! python -m virtualenv venv 2>/dev/null; then
332
- /opt/mongodbtoolchain/v3/bin/python3 -m venv venv
352
+ if [ ! -d ../drivers-evergreen-tools ]; then
353
+ git clone --depth 1 [email protected] :mongodb-labs/drivers-evergreen-tools.git ../drivers-evergreen-tools
333
354
fi
355
+ . ../drivers-evergreen-tools/.evergreen/find-python3.sh
356
+ . ../drivers-evergreen-tools/.evergreen/venv-utils.sh
334
357
335
- cd venv
336
- if [ -f bin/activate ]; then
337
- . bin/activate
338
- ./bin/pip install GitPython
339
- elif [ -f Scripts/activate ]; then
340
- . Scripts/activate
341
- ./Scripts/pip install GitPython
342
- fi
343
- cd ..
358
+ venvcreate "$(find_python3)" venv
359
+ python -m pip install GitPython
344
360
345
361
export GENERATOR="${generator}"
346
362
@@ -417,14 +433,35 @@ functions:
417
433
# export environment variables for encryption tests
418
434
set +o errexit
419
435
420
- if [ "Windows_NT" == "$OS"]; then
421
- export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS\.evergreen\x509gen\ca.pem
422
- export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS\.evergreen\x509gen\client.pem
423
- else
424
- export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
425
- export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem
436
+ # Avoid printing credentials in logs.
437
+ set +o xtrace
438
+
439
+ echo "Setting temporary credentials..."
440
+ pushd "$DRIVERS_TOOLS/.evergreen/csfle"
441
+ export AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}"
442
+ export AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}"
443
+ export AWS_DEFAULT_REGION="us-east-1"
444
+ echo "Running activate-kmstlsvenv.sh..."
445
+ . ./activate-kmstlsvenv.sh
446
+ echo "Running activate-kmstlsvenv.sh... done."
447
+ echo "Running set-temp-creds.sh..."
448
+ . ./set-temp-creds.sh
449
+ echo "Running set-temp-creds.sh... done."
450
+ deactivate
451
+ popd # "$DRIVERS_TOOLS/.evergreen/csfle"
452
+ echo "Setting temporary credentials... done."
453
+
454
+ # Ensure temporary credentials were properly set.
455
+ if [ -z "$CSFLE_AWS_TEMP_ACCESS_KEY_ID" ]; then
456
+ echo "Failed to set temporary credentials!"
457
+ exit 1
426
458
fi
427
459
460
+ export MONGOCXX_TEST_CSFLE_TLS_CA_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem
461
+ export MONGOCXX_TEST_CSFLE_TLS_CERTIFICATE_KEY_FILE=$DRIVERS_TOOLS/.evergreen/x509gen/client.pem
462
+ export MONGOCXX_TEST_AWS_TEMP_ACCESS_KEY_ID="$CSFLE_AWS_TEMP_ACCESS_KEY_ID"
463
+ export MONGOCXX_TEST_AWS_TEMP_SECRET_ACCESS_KEY="$CSFLE_AWS_TEMP_SECRET_ACCESS_KEY"
464
+ export MONGOCXX_TEST_AWS_TEMP_SESSION_TOKEN="$CSFLE_AWS_TEMP_SESSION_TOKEN"
428
465
export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}"
429
466
export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}"
430
467
export MONGOCXX_TEST_AZURE_TENANT_ID="${cse_azure_tenant_id}"
0 commit comments