@@ -330,6 +330,7 @@ functions:
330
330
set +x
331
331
${PREPARE_CSFLE}
332
332
export KMS_MOCK_SERVERS_ENABLED=true
333
+ export GCE_METADATA_HOST="localhost:5000"
333
334
${PREPARE_SHELL}
334
335
set +o xtrace
335
336
OS=${OS} \
@@ -741,7 +742,7 @@ functions:
741
742
cd ${DRIVERS_TOOLS}/.evergreen/csfle
742
743
$PYTHON -u kms_http_server.py -v --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert
743
744
744
- start-kms-kmip-server :
745
+ start-kms-mock- kmip-server :
745
746
- command : shell.exec
746
747
params :
747
748
script : |
@@ -756,6 +757,25 @@ functions:
756
757
cd ${DRIVERS_TOOLS}/.evergreen/csfle
757
758
$PYTHON -u kms_kmip_server.py
758
759
760
+ start-kms-mock-gcp-server :
761
+ - command : shell.exec
762
+ params :
763
+ script : |
764
+ ${PREPARE_SHELL}
765
+ cd ${DRIVERS_TOOLS}/.evergreen/csfle
766
+ . ./activate_venv.sh
767
+ - command : shell.exec
768
+ params :
769
+ background : true
770
+ script : |
771
+ PYTHON=$(Venv="${DRIVERS_TOOLS}/.evergreen/csfle/kmstlsvenv" OS=${OS} ${PROJECT_DIRECTORY}/evergreen/get-python-path.sh);
772
+ cd ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms
773
+ $PYTHON -m pip install PyJWT
774
+ mkdir ${DRIVERS_TOOLS}/tmp
775
+ echo '${GOOGLE_APPLICATION_CREDENTIALS_CONTENT}' > ${DRIVERS_TOOLS}/tmp/testgcpkms_key_file.json
776
+ export GOOGLE_APPLICATION_CREDENTIALS=${DRIVERS_TOOLS}/tmp/testgcpkms_key_file.json
777
+ $PYTHON -u mock_server.py
778
+
759
779
cleanup :
760
780
- command : shell.exec
761
781
params :
@@ -874,7 +894,8 @@ tasks:
874
894
- name : test-csfle-with-mocked-kms-tls-net472
875
895
commands :
876
896
- func : start-kms-mock-servers
877
- - func : start-kms-kmip-server
897
+ - func : start-kms-mock-kmip-server
898
+ - func : start-kms-mock-gcp-server
878
899
- func : bootstrap-mongo-orchestration
879
900
- func : run-csfle-with-mocked-kms-tests
880
901
vars :
@@ -883,7 +904,8 @@ tasks:
883
904
- name : test-csfle-with-mocked-kms-tls-netstandard20
884
905
commands :
885
906
- func : start-kms-mock-servers
886
- - func : start-kms-kmip-server
907
+ - func : start-kms-mock-kmip-server
908
+ - func : start-kms-mock-gcp-server
887
909
- func : bootstrap-mongo-orchestration
888
910
- func : run-csfle-with-mocked-kms-tests
889
911
vars :
@@ -892,7 +914,8 @@ tasks:
892
914
- name : test-csfle-with-mocked-kms-tls-netstandard21
893
915
commands :
894
916
- func : start-kms-mock-servers
895
- - func : start-kms-kmip-server
917
+ - func : start-kms-mock-kmip-server
918
+ - func : start-kms-mock-gcp-server
896
919
- func : bootstrap-mongo-orchestration
897
920
- func : run-csfle-with-mocked-kms-tests
898
921
vars :
@@ -1350,6 +1373,40 @@ tasks:
1350
1373
# OCSP_ALGORITHM: "ecdsa"
1351
1374
# OCSP_TLS_SHOULD_SUCCEED: "false"
1352
1375
1376
+ - name : test-csfle-with-gcp-kms
1377
+ commands :
1378
+ - command : shell.exec
1379
+ type : setup
1380
+ params :
1381
+ working_dir : mongo-csharp-driver
1382
+ shell : " bash"
1383
+ script : |
1384
+ ${PREPARE_SHELL}
1385
+ echo "Copying files ... begin"
1386
+ export GCPKMS_GCLOUD=${GCPKMS_GCLOUD}
1387
+ export GCPKMS_PROJECT=${GCPKMS_PROJECT}
1388
+ export GCPKMS_ZONE=${GCPKMS_ZONE}
1389
+ export GCPKMS_INSTANCENAME=${GCPKMS_INSTANCENAME}
1390
+ tar czf /tmp/mongo-csharp-driver.tgz .
1391
+ GCPKMS_SRC=/tmp/mongo-csharp-driver.tgz GCPKMS_DST=$GCPKMS_INSTANCENAME: $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/copy-file.sh
1392
+ echo "Copying files ... end"
1393
+ echo "Untarring file ... begin"
1394
+ GCPKMS_CMD="tar xf mongo-csharp-driver.tgz" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh
1395
+ echo "Untarring file ... end"
1396
+
1397
+ - command : shell.exec
1398
+ type : test
1399
+ params :
1400
+ working_dir : " mongo-csharp-driver"
1401
+ shell : " bash"
1402
+ script : |
1403
+ ${PREPARE_SHELL}
1404
+ export GCPKMS_GCLOUD=${GCPKMS_GCLOUD}
1405
+ export GCPKMS_PROJECT=${GCPKMS_PROJECT}
1406
+ export GCPKMS_ZONE=${GCPKMS_ZONE}
1407
+ export GCPKMS_INSTANCENAME=${GCPKMS_INSTANCENAME}
1408
+ GCPKMS_CMD="MONGODB_URI='mongodb://localhost:27017' ./evergreen/run-csfle-gcp-tests.sh" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh
1409
+
1353
1410
axes :
1354
1411
- id : version
1355
1412
display_name : MongoDB Version
@@ -1467,6 +1524,46 @@ axes:
1467
1524
variables :
1468
1525
COMPRESSOR : " zstd"
1469
1526
1527
+ task_groups :
1528
+ - name : testgcpkms-task-group
1529
+ setup_group_can_fail_task : true
1530
+ setup_group_timeout_secs : 1800 # 30 minutes
1531
+ setup_group :
1532
+ - func : fetch-source
1533
+ - func : prepare-resources
1534
+ - func : windows-fix
1535
+ - func : fix-absolute-paths
1536
+ - func : init-test-results
1537
+ - func : make-files-executable
1538
+ - command : shell.exec
1539
+ params :
1540
+ shell : " bash"
1541
+ script : |
1542
+ ${PREPARE_SHELL}
1543
+ echo '${GOOGLE_APPLICATION_CREDENTIALS_CONTENT}' > /tmp/testgcpkms_key_file.json
1544
+ export GCPKMS_KEYFILE=/tmp/testgcpkms_key_file.json
1545
+ export GCPKMS_DRIVERS_TOOLS=$DRIVERS_TOOLS
1546
+ export GCPKMS_SERVICEACCOUNT="${GCPKMS_SERVICEACCOUNT}"
1547
+ export GCPKMS_MACHINETYPE="e2-standard-4"
1548
+ $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/create-and-setup-instance.sh
1549
+ # Load the GCPKMS_GCLOUD, GCPKMS_INSTANCE, GCPKMS_REGION, and GCPKMS_ZONE expansions.
1550
+ - command : expansions.update
1551
+ params :
1552
+ file : testgcpkms-expansions.yml
1553
+ teardown_group :
1554
+ - command : shell.exec
1555
+ params :
1556
+ shell : " bash"
1557
+ script : |
1558
+ ${PREPARE_SHELL}
1559
+ export GCPKMS_GCLOUD=${GCPKMS_GCLOUD}
1560
+ export GCPKMS_PROJECT=${GCPKMS_PROJECT}
1561
+ export GCPKMS_ZONE=${GCPKMS_ZONE}
1562
+ export GCPKMS_INSTANCENAME=${GCPKMS_INSTANCENAME}
1563
+ $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/delete-instance.sh
1564
+ tasks :
1565
+ - test-csfle-with-gcp-kms
1566
+
1470
1567
buildvariants :
1471
1568
1472
1569
- matrix_name : " secure-tests"
@@ -1716,3 +1813,9 @@ buildvariants:
1716
1813
tasks :
1717
1814
- name : test-csfle-with-mongocryptd-netstandard21
1718
1815
1816
+ - matrix_name : " csfle-with-gcp-kms-tests-linux"
1817
+ matrix_spec : { ssl: "nossl", os: "ubuntu-1804" }
1818
+ display_name : " CSFLE with GCP KMS ${os}"
1819
+ batchtime : 20160 # 14 days
1820
+ tasks :
1821
+ - name : testgcpkms-task-group
0 commit comments