Skip to content

Commit

Permalink
DRIVERS-3099 Add option for using existing mongodb binaries dir (#593)
Browse files Browse the repository at this point in the history
Co-authored-by: Ezra Chung <[email protected]>
  • Loading branch information
blink1073 and eramongodb authored Feb 10, 2025
1 parent f43767d commit 92b9054
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .evergreen/orchestration/drivers_orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def get_options():
other_group.add_argument(
"--mongodb-binaries", help="The path to store the MongoDB binaries"
)
other_group.add_argument(
"--existing-binaries-dir",
help="A directory containing existing mongodb binaries to use instead of downloading new ones.",
)

# Get the options, and then allow environment variable overrides.
opts = parser.parse_args()
Expand Down Expand Up @@ -197,9 +201,13 @@ def run(opts):
default_args += " -v"
args = f"{default_args} --version {version}"
args += " --strip-path-components 2 --component archive"
LOGGER.info(f"Downloading mongodb {version}...")
mongodl(shlex.split(args))
LOGGER.info(f"Downloading mongodb {version}... done.")
if not opts.existing_binaries_dir:
LOGGER.info(f"Downloading mongodb {version}...")
mongodl(shlex.split(args))
LOGGER.info(f"Downloading mongodb {version}... done.")
else:
LOGGER.info(f"Using existing mongod binaries dir: {opts.existing_binaries_dir}")
shutil.copytree(opts.existing_binaries_dir, mdb_binaries)

# Download legacy shell.
if opts.install_legacy_shell:
Expand Down
8 changes: 8 additions & 0 deletions .evergreen/tests/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ else
./mongosh-dl --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1
fi

# Ensure that we can use a downloaded mongodb directory.
rm -rf ${DOWNLOAD_DIR}
bash install-cli.sh "$(pwd)/orchestration"
./mongodl --edition enterprise --version 7.0 --component archive --out ${DOWNLOAD_DIR} --strip-path-components 2
./orchestration/drivers-orchestration run --existing-binaries-dir=${DOWNLOAD_DIR}
${DOWNLOAD_DIR}/mongod --version | grep v7.0
./orchestration/drivers-orchestration stop

if [ ${1:-} == "partial" ]; then
popd
make -C ${DRIVERS_TOOLS} test
Expand Down

0 comments on commit 92b9054

Please sign in to comment.