Skip to content

DRIVERS-3628 Migrate "latest" server binary downloads to private S3 - #840

Merged
blink1073 merged 52 commits into
mongodb-labs:masterfrom
blink1073:worktree-DRIVERS-3622-s3-latest-spike
Sep 22, 2026
Merged

blink1073 merged 52 commits into
mongodb-labs:masterfrom
blink1073:worktree-DRIVERS-3622-s3-latest-spike

Conversation

@blink1073

@blink1073 blink1073 commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

DRIVERS-3628

Summary

DEVPROD-42370 moves MongoDB "latest"/nightly server binaries from public HTTP hosts to a private S3 bucket. This migrates mongodl to resolve latest and latest-build through presigned S3 URLs, and defaults the non-nightly entry points to latest-stable so they keep working without AWS credentials.

Changes in this PR

  • Resolve latest and latest-build with presigned S3 URls created by server_artifacts.py.
  • Allow for three usage scenarios:
    • Already have the credentials to access the S3 bucket
    • Can use the drivers-test-secrets-role to hop roles and access the S3 bucket
    • Can use the sso login for drivers-test-secrets to hop 2 roles and access the S3 bucket.
  • Default the non-build versions (run-mongodb.sh, run-orchestration.sh, the Docker wrapper, serverless/download-crypt.sh, and the cloud-VM scripts) to latest-stable
  • The GitHub Action maps latest to latest-stable.
  • Note to reviewer: about half of the diff is from the auto-generated lock files.

Migration Guide

latest and latest-build now download unpublished nightly builds from a private S3 bucket instead of the public downloads.10gen.com and downloads.mongodb.com hosts, so they require an AWS identity. latest-stable and pinned released versions are unchanged and need no credentials.

  • Evergreen: assume drivers_test_secrets_role (for example via ec2.assume_role) before the download. Pass the AWS credentials to the driver orchestration step.
  • Local: use an AWS_PROFILE with drivers test secrets credentials.
  • GitHub Action: latest is remapped to latest-stable, so no credentials are needed there.
  • Defaults: run-mongodb.sh, run-orchestration.sh, the Docker wrapper, and serverless/download-crypt.sh now default to latest-stable. Under --local-atlas the Docker image tag stays latest.
  • Docker container: to download an unpublished version, set MONGODL_PRIVATE_ARTIFACTS=1 so the host's AWS identity is forwarded into the container.

Test Plan

  • make lint clean.
  • mongodl --version latest and --version latest-build resolve to presigned S3 URLs locally using AWS_PROFILE=drivers-test; a run with no AWS identity fails with a clear message.
  • Docker test-docker exercises the latest download with assumed credentials.
  • Evergreen test-latest-*, test-docker, and the latest-stable partial CLI/mongodb-runner tests.

Checklist

Checklist for Author

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

Rewrite mongodl.py's _latest_build_url() to resolve a presigned S3 URL
against the origin-mongodb-server-latest bucket instead of building an
HTTP URL against downloads.10gen.com, chaining through
drivers-test-secrets-role to the role/bucket/prefix named in the
drivers/devprod-release-infrastructure secret. Add boto3 as a
dependency, add an ec2.assume_role step to bootstrap mongo-orchestration,
and include a standalone spike script proving out the credential chain.
latest_spike.py was a throwaway local proof-of-concept for the
credential chain; the same logic now lives in mongodl.py itself.
GitHub Actions runners don't have S3 access to the private "latest"
nightly builds, so under GITHUB_ACTION, default to (and alias "latest"
to) the newest published release instead. Evergreen's default of
"latest" is unchanged.
mongodb-atlas-local's Docker image only publishes a "latest" tag, not
"latest-stable", so aliasing broke `docker run` for local_atlas
consumers on GitHub Actions.
crypt_shared's separate mongodl invocation shares opts.version with the
mongodb-atlas-local Docker tag and isn't gated by local_atlas, so
exempting local_atlas from the alias (previous commit) left crypt_shared
still requesting the private S3 "latest" build with no AWS credentials
in GitHub Actions, crashing with NoCredentialsError.

Alias only the value passed to mongodl (archive + crypt_shared),
leaving opts.version itself untouched for the Docker tag and the
mongodb_runner version-compat check.
Add a note under "Using In Evergreen" explaining that "latest"/
"latest-build" now downloads from a private S3 bucket and requires
assuming drivers_test_secrets_role. Update the GitHub Actions "version"
input description to document the default/alias to "latest-stable".
…from env

Both were hardcoded string constants; read them from the environment
instead, since they're now provisioned via a secrets vault rather than
being safe to bake into source.
mongodl.py now reads this from the environment unconditionally (not
just on the local, non-ambient-creds path), so Evergreen tasks need it
too, not just AWS_ACCESS_KEY_ID/etc.
…m a vault

These are sourced from the drivers/devprod-release-infrastructure AWS
Secrets Vault via setup-secrets.sh, not an Evergreen project variable.
Since setup-secrets.sh requires bash but bootstrap mongo-orchestration's
main step uses sh, add a separate bash step that fetches them and
promotes them to Evergreen expansions via expansions.update, so the
existing sh step can pick them up like AWS_ACCESS_KEY_ID already does.

Only fetches when downloading latest/latest-build, to avoid an
unnecessary SecretsManager call for pinned-version tasks.
Revert the separate fetch-server-artifacts-secrets.sh script and its
Evergreen wiring. mongodl.py now reads the drivers/devprod-release-
infrastructure vault directly, using whatever AWS identity is already
active:

- The vault itself is readable with the ambient identity directly, no
  assume-role hop needed (confirmed empirically).
- Assuming the S3 artifacts role does need drivers-test-secrets-role's
  own identity specifically, not an SSO permission set's distinct
  auto-generated role, so locally we assume it using the ARN the vault
  itself provides (DRIVERS_TEST_SECRETS_ROLE_ARN) -- no hardcoded ARN,
  no pre-exported env vars, no separate script.
- In Evergreen, ec2.assume_role already makes the ambient identity
  drivers-test-secrets-role, so that extra hop is skipped entirely.

Verified locally end-to-end for both the AWS_PROFILE (local) and
ambient-env-vars (simulated Evergreen) paths, with nothing pre-exported
beyond the credentials Evergreen's ec2.assume_role or a local aws sso
login already provide.
mongodb-runner is used for local dev and GitHub Actions, neither of
which should require S3 credentials just to spin up a default server.
Extend the existing GITHUB_ACTION alias condition to also trigger for
--mongodb-runner, regardless of environment.
Evergreen consumers won't all assume drivers-test-secrets-role, so
explicit "latest" is a breaking change regardless. Keep it consistent:
change only the default, never rewrite an explicit "latest".
Try the ambient identity first, then the artifacts role assumed directly,
then the artifacts role reached through drivers-test-secrets-role.
The Docker tag stays "latest", but crypt_shared is a separate download
that "latest" now routes to private S3.
GitHub Actions runners have no AWS credentials for the private "latest"
nightly, so the action downloads the newest stable release instead. mongodl
keeps "latest" meaning the nightly build.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Presigned credentials may leak in logs, and the AWS access, caching, and GitHub fallback issues must be addressed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Migrates nightly MongoDB binary downloads to authenticated private S3 presigned URLs.

Changes:

  • Adds AWS credential resolution and S3 URL generation.
  • Updates version mapping, caching, dependencies, documentation, and Evergreen configuration.
File summaries
File Review
README.md Documents private downloads; needs clarification for local Atlas and unpublished versions (nits).
action.yml Documents version mapping; needs the local-Atlas exception clarified (nit).
.evergreen/uv.lock Locks new AWS dependencies.
.evergreen/server_artifacts.py Adds credential resolution and presigned URLs.
.evergreen/run-mongodb.sh Updates the documented default version.
.evergreen/pyproject.toml Adds boto3 and packages the resolver.
.evergreen/orchestration/uv.lock Updates orchestration dependencies.
.evergreen/orchestration/drivers_orchestration.py Adds version mapping; unpublished versions can bypass the GitHub fallback and require unavailable credentials (moderate).
.evergreen/mongodl.py Routes nightly artifacts through S3, but presigned URLs break stable caching (moderate) and expose credentials in logs (critical).
.evergreen/config.yml Adds role assumption too broadly, potentially breaking non-nightly tasks without AWS access (moderate).
Review details

Suppressed comments (1)

README.md:59

  • This statement excludes pinned versions, but drivers_orchestration.py currently rewrites every entry in UNPUBLISHED_VERSIONS (currently 9.0) to latest-build, so those pinned inputs also require private-S3 credentials. Document that unpublished-version exception so users do not expect such versions to work without AWS access.
[Secrets Handling](.evergreen/secrets_handling/README.md)). Any version other
than `latest`/`latest-build` (e.g. `latest-stable`, or a pinned version like
`8.0`) is unaffected and needs no AWS access.
  • Files reviewed: 8/10 changed files
  • Comments generated: 6
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .evergreen/mongodl.py Resolved
Comment thread .evergreen/config.yml Resolved
Comment thread .evergreen/mongodl.py Resolved
Comment thread README.md Resolved
Comment thread action.yml Resolved
Assume drivers_test_secrets_role in the CLI, mongodb-runner, and docker
tests, forward AWS credentials into the docker container, and pin the azure
OIDC server to latest-stable.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Private IAM role chaining, presigned artifact paths, and credential forwarding require final validation against the production AWS configuration.

Review details
  • Files reviewed: 20/22 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

…3622-s3-latest-spike

# Conflicts:
#	.evergreen/orchestration/drivers_orchestration.py
@blink1073 blink1073 closed this Sep 14, 2026
@blink1073 blink1073 reopened this Sep 14, 2026
The test-otel Evergreen task downloads MongoDB 'latest' builds through a
presigned private S3 URL and needs the drivers-test-secrets role. Its
subprocess didn't forward the assumed-role AWS credentials, so mongodl
fell back to the unprivileged instance role, which cannot read the
drivers/devprod-release-infrastructure vault. Add the same
include_expansions_in_env forwarding used by the other 'latest' tests.
@blink1073 blink1073 closed this Sep 15, 2026
@blink1073 blink1073 reopened this Sep 15, 2026
@blink1073
blink1073 marked this pull request as draft September 15, 2026 18:08
@blink1073
blink1073 marked this pull request as ready for review September 15, 2026 18:08
Comment thread action.yml Resolved
Comment thread .evergreen/server_artifacts.py Resolved
Comment thread .evergreen/config.yml Resolved
Comment thread .evergreen/server_artifacts.py Resolved
Restores the version-mismatch warning, splits the vault-read error
handling into client-side and server-side branches, and documents the
release-infrastructure vault and latest-build usage.
@PavelSafronov PavelSafronov self-assigned this Sep 17, 2026
@PavelSafronov

Copy link
Copy Markdown
Collaborator

CI is failing with pyo3-ffi v0.24.1. Updating the branch should pick up #843 and resolve this.

PavelSafronov
PavelSafronov previously approved these changes Sep 17, 2026

@PavelSafronov PavelSafronov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good, approving.

@blink1073

Copy link
Copy Markdown
Member Author

After a fix to fallback handling in e8edbc8, I was able to confirm that it works as intended in Evergreen:

[2026/09/21 09:33:50.906] WARNING  FALLBACK: Could not resolve AWS credentials for the private S3 bucket, so the latest build will be downloaded from the LEGACY public host instead:
[2026/09/21 09:33:50.906] WARNING      https://downloads.10gen.com/osx/mongodb-macos-arm64-enterprise-latest.tgz
[2026/09/21 09:33:50.906] WARNING  This legacy link is deprecated and will be removed in a future release. Configure AWS credentials (see the DRIVERS-3628 migration guide) to download from S3.
[2026/09/21 09:33:50.906] WARNING  ******************************************************************************

I'm working on verifying the "latest" behavior in the GitHub Action now

@blink1073

Copy link
Copy Markdown
Member Author

Confirmed here:

  INFO     Downloading mongodb latest-stable to /home/runner/work/_actions/blink1073/drivers-evergreen-tools/worktree-DRIVERS-3622-s3-latest-spike/mongodb/bin...

Versus on a recent run without this change:

  INFO     Downloading mongodb latest to /home/runner/work/_actions/mongodb-labs/drivers-evergreen-tools/master/mongodb/bin...

@PavelSafronov PavelSafronov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

@blink1073
blink1073 merged commit ec0b149 into mongodb-labs:master Sep 22, 2026
77 checks passed
@blink1073
blink1073 deleted the worktree-DRIVERS-3622-s3-latest-spike branch September 22, 2026 15:43
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.

3 participants