Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRIVERS-2723: ensure atlas cluster names are unique #351

Merged
merged 8 commits into from
Sep 15, 2023

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Sep 14, 2023

The previous changes to make cluster names unique did not actually produce unique cluster names. each task id starts with the project name, so piping the task_id into base64 | head -c 8 produces the same string for each evergreen project.

This PR does two things:

  • The task id is now hashed to ensure that it is unique per-commit per-CI run per-driver
  • the execution expansion is also included, to ensure function names are unique across restarts

patch in Node showing unique cluster names for both tasks that use these scripts in CI: https://spruce.mongodb.com/version/65035e55d6d80a62019a64bc/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

# - the string cannot be > 64 characters long, so we hash the name to shorten it and maintain its uniqueness (hashes do have collisions but infrequently
# enough that hashing suffices here)
# - we convert it to hex encoding because cluster names must be alphanumeric (hyphens are allowed)
transform="process.stdout.write(require('crypto').createHash('md5').update(process.argv[1]).digest().toString('hex'))"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a hashing CLI tool that would reliably be available across all distros in CI.

Node should be pre-installed on every distro.

@baileympearson baileympearson marked this pull request as ready for review September 14, 2023 19:35
Copy link
Member

@durran durran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node patch run on affected variants: https://spruce.mongodb.com/version/6503802d32f417b863191cf2/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

Just realised you already linked one and didn't need to start my own. :)

LGTM

@durran durran merged commit 1f018c7 into mongodb-labs:master Sep 15, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants