Skip to content

Commit da88d0f

Browse files
authored
CDRIVER-4519 Replace activate_venv.sh with new hygienic scripts (#1155)
* Replace activate_venv.sh with hygienic alternatives * Workaround Python 3.10 default cipher suite incompatibility on Windows
1 parent a60ac70 commit da88d0f

File tree

2 files changed

+44
-20
lines changed

2 files changed

+44
-20
lines changed

.evergreen/config.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,11 @@ functions:
442442
export AWS_SECRET_ACCESS_KEY="${client_side_encryption_aws_secret_access_key}"
443443
export AWS_ACCESS_KEY_ID="${client_side_encryption_aws_access_key_id}"
444444
export AWS_DEFAULT_REGION="us-east-1"
445-
echo "Running activate_venv.sh..."
446-
. ./activate_venv.sh
447-
echo "Running activate_venv.sh... done."
445+
echo "Running activate-kmstlsvenv.sh..."
446+
. ./activate-kmstlsvenv.sh
447+
echo "Running activate-kmstlsvenv.sh... done."
448448
echo "Running set-temp-creds.sh..."
449-
PYTHON="$(type -P python)" . ./set-temp-creds.sh
449+
. ./set-temp-creds.sh
450450
echo "Running set-temp-creds.sh... done."
451451
deactivate
452452
popd
@@ -789,7 +789,9 @@ functions:
789789
set +o xtrace
790790
export IAM_AUTH_ECS_ACCOUNT=${iam_auth_ecs_account}
791791
export IAM_AUTH_ECS_SECRET_ACCESS_KEY=${iam_auth_ecs_secret_access_key}
792-
. ../drivers-evergreen-tools/.evergreen/auth_aws/activate_venv.sh
792+
pushd ../drivers-evergreen-tools/.evergreen/auth_aws
793+
. ./activate-authawsvenv.sh
794+
popd # ../drivers-evergreen-tools/.evergreen/auth_aws
793795
sh ./.evergreen/run-aws-tests.sh ${TESTCASE}
794796
clone drivers-evergreen-tools:
795797
- command: shell.exec
@@ -808,13 +810,23 @@ functions:
808810
set -o errexit
809811
echo "Preparing CSFLE venv environment..."
810812
cd ./drivers-evergreen-tools/.evergreen/csfle
811-
# This function ensures future invocations of activate_venv.sh conducted in
813+
# This function ensures future invocations of activate-kmstlsvenv.sh conducted in
812814
# parallel do not race to setup a venv environment; it has already been prepared.
813815
# This primarily addresses the situation where the "run tests" and "run kms servers"
814-
# functions invoke 'activate_venv.sh' simultaneously.
816+
# functions invoke 'activate-kmstlsvenv.sh' simultaneously.
815817
# TODO: remove this function along with the "run kms servers" function.
816-
. ./activate_venv.sh
817-
deactivate
818+
if [[ "$OSTYPE" =~ cygwin && ! -d kmstlsvenv ]]; then
819+
# Avoid using Python 3.10 on Windows due to incompatible cipher suites.
820+
# See CDRIVER-4530.
821+
. ../venv-utils.sh
822+
venvcreate "C:/python/Python39/python.exe" kmstlsvenv || # windows-2017
823+
venvcreate "C:/python/Python38/python.exe" kmstlsvenv # windows-2015
824+
python -m pip install --upgrade boto3~=1.19 pykmip~=0.10.0
825+
deactivate
826+
else
827+
. ./activate-kmstlsvenv.sh
828+
deactivate
829+
fi
818830
echo "Preparing CSFLE venv environment... done."
819831
- command: shell.exec
820832
params:
@@ -824,7 +836,7 @@ functions:
824836
set -o errexit
825837
echo "Starting mock KMS servers..."
826838
cd ./drivers-evergreen-tools/.evergreen/csfle
827-
. ./activate_venv.sh
839+
. ./activate-kmstlsvenv.sh
828840
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
829841
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
830842
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &

build/evergreen_config_lib/functions.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@
315315
export AWS_SECRET_ACCESS_KEY="${client_side_encryption_aws_secret_access_key}"
316316
export AWS_ACCESS_KEY_ID="${client_side_encryption_aws_access_key_id}"
317317
export AWS_DEFAULT_REGION="us-east-1"
318-
echo "Running activate_venv.sh..."
319-
. ./activate_venv.sh
320-
echo "Running activate_venv.sh... done."
318+
echo "Running activate-kmstlsvenv.sh..."
319+
. ./activate-kmstlsvenv.sh
320+
echo "Running activate-kmstlsvenv.sh... done."
321321
echo "Running set-temp-creds.sh..."
322-
PYTHON="$(type -P python)" . ./set-temp-creds.sh
322+
. ./set-temp-creds.sh
323323
echo "Running set-temp-creds.sh... done."
324324
deactivate
325325
popd
@@ -581,7 +581,9 @@
581581
set +o xtrace
582582
export IAM_AUTH_ECS_ACCOUNT=${iam_auth_ecs_account}
583583
export IAM_AUTH_ECS_SECRET_ACCESS_KEY=${iam_auth_ecs_secret_access_key}
584-
. ../drivers-evergreen-tools/.evergreen/auth_aws/activate_venv.sh
584+
pushd ../drivers-evergreen-tools/.evergreen/auth_aws
585+
. ./activate-authawsvenv.sh
586+
popd # ../drivers-evergreen-tools/.evergreen/auth_aws
585587
sh ./.evergreen/run-aws-tests.sh ${TESTCASE}
586588
''')
587589
)),
@@ -596,19 +598,29 @@
596598
shell_exec(r'''
597599
echo "Preparing CSFLE venv environment..."
598600
cd ./drivers-evergreen-tools/.evergreen/csfle
599-
# This function ensures future invocations of activate_venv.sh conducted in
601+
# This function ensures future invocations of activate-kmstlsvenv.sh conducted in
600602
# parallel do not race to setup a venv environment; it has already been prepared.
601603
# This primarily addresses the situation where the "run tests" and "run kms servers"
602-
# functions invoke 'activate_venv.sh' simultaneously.
604+
# functions invoke 'activate-kmstlsvenv.sh' simultaneously.
603605
# TODO: remove this function along with the "run kms servers" function.
604-
. ./activate_venv.sh
605-
deactivate
606+
if [[ "$OSTYPE" =~ cygwin && ! -d kmstlsvenv ]]; then
607+
# Avoid using Python 3.10 on Windows due to incompatible cipher suites.
608+
# See CDRIVER-4530.
609+
. ../venv-utils.sh
610+
venvcreate "C:/python/Python39/python.exe" kmstlsvenv || # windows-2017
611+
venvcreate "C:/python/Python38/python.exe" kmstlsvenv # windows-2015
612+
python -m pip install --upgrade boto3~=1.19 pykmip~=0.10.0
613+
deactivate
614+
else
615+
. ./activate-kmstlsvenv.sh
616+
deactivate
617+
fi
606618
echo "Preparing CSFLE venv environment... done."
607619
''', test=False),
608620
shell_exec(r'''
609621
echo "Starting mock KMS servers..."
610622
cd ./drivers-evergreen-tools/.evergreen/csfle
611-
. ./activate_venv.sh
623+
. ./activate-kmstlsvenv.sh
612624
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
613625
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
614626
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &

0 commit comments

Comments
 (0)