Skip to content

Commit

Permalink
ensure setup-cluster.sh creates unique atlas clusters(#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Sep 7, 2023
1 parent 0b38e20 commit 6f42c3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .evergreen/atlas/setup-atlas-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion .evergreen/atlas/setup-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"
FUNCTION_NAME="${LAMBDA_STACK_NAME}-${TASK_NAME}-$(git rev-parse --short HEAD)"
1 change: 1 addition & 0 deletions .evergreen/atlas/teardown-atlas-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f42c3b

Please sign in to comment.