diff --git a/.evergreen/atlas/setup-atlas-cluster.sh b/.evergreen/atlas/setup-atlas-cluster.sh index 3fd2fe2e..a61820c1 100755 --- a/.evergreen/atlas/setup-atlas-cluster.sh +++ b/.evergreen/atlas/setup-atlas-cluster.sh @@ -25,6 +25,7 @@ DRIVERS_ATLAS_GROUP_ID DRIVERS_ATLAS_LAMBDA_USER DRIVERS_ATLAS_LAMBDA_PASSWORD LAMBDA_STACK_NAME +task_id ) # Ensure that all variables required to run the test are set, otherwise throw diff --git a/.evergreen/atlas/setup-variables.sh b/.evergreen/atlas/setup-variables.sh index c4daeee7..01a96a25 100644 --- a/.evergreen/atlas/setup-variables.sh +++ b/.evergreen/atlas/setup-variables.sh @@ -9,6 +9,8 @@ set -o errexit # Exit the script with error if any of the commands fail # # FUNCTION_NAME: Uses the stack name plus the current commit sha to create a unique cluster and function. # ATLAS_BASE_URL: Where the Atlas API root resides. +# task_id: The `task_id` evergreen expansion associated with the CI run (or a unique identifier with which to create the function name). +# Note: This MUST be unique per-CI task. Otherwise, multiple tasks calling this script may attempt to create clusters with the same name. # The Atlas API version @@ -17,5 +19,8 @@ ATLAS_API_VERSION="v1.0" # support testing cluster outages. ATLAS_BASE_URL="https://cloud.mongodb.com/api/atlas/$ATLAS_API_VERSION" +# create a unique per CI task tag for the function. +TASK_NAME=$(echo $task_id | base64 | head -c 8) + # Add git commit to name of function and cluster. -FUNCTION_NAME="${LAMBDA_STACK_NAME}-$(git rev-parse --short HEAD)" \ No newline at end of file +FUNCTION_NAME="${LAMBDA_STACK_NAME}-${TASK_NAME}-$(git rev-parse --short HEAD)" \ No newline at end of file diff --git a/.evergreen/atlas/teardown-atlas-cluster.sh b/.evergreen/atlas/teardown-atlas-cluster.sh index 0d0d7c2c..4e2bb530 100755 --- a/.evergreen/atlas/teardown-atlas-cluster.sh +++ b/.evergreen/atlas/teardown-atlas-cluster.sh @@ -18,6 +18,7 @@ DRIVERS_ATLAS_PUBLIC_API_KEY DRIVERS_ATLAS_PRIVATE_API_KEY DRIVERS_ATLAS_GROUP_ID LAMBDA_STACK_NAME +task_id ) # Ensure that all variables required to run the test are set, otherwise throw