Skip to content

Commit 92b9054

Browse files
DRIVERS-3099 Add option for using existing mongodb binaries dir (#593)
Co-authored-by: Ezra Chung <ezra.chung@mongodb.com>
1 parent f43767d commit 92b9054

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.evergreen/orchestration/drivers_orchestration.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def get_options():
9898
other_group.add_argument(
9999
"--mongodb-binaries", help="The path to store the MongoDB binaries"
100100
)
101+
other_group.add_argument(
102+
"--existing-binaries-dir",
103+
help="A directory containing existing mongodb binaries to use instead of downloading new ones.",
104+
)
101105

102106
# Get the options, and then allow environment variable overrides.
103107
opts = parser.parse_args()
@@ -197,9 +201,13 @@ def run(opts):
197201
default_args += " -v"
198202
args = f"{default_args} --version {version}"
199203
args += " --strip-path-components 2 --component archive"
200-
LOGGER.info(f"Downloading mongodb {version}...")
201-
mongodl(shlex.split(args))
202-
LOGGER.info(f"Downloading mongodb {version}... done.")
204+
if not opts.existing_binaries_dir:
205+
LOGGER.info(f"Downloading mongodb {version}...")
206+
mongodl(shlex.split(args))
207+
LOGGER.info(f"Downloading mongodb {version}... done.")
208+
else:
209+
LOGGER.info(f"Using existing mongod binaries dir: {opts.existing_binaries_dir}")
210+
shutil.copytree(opts.existing_binaries_dir, mdb_binaries)
203211

204212
# Download legacy shell.
205213
if opts.install_legacy_shell:

.evergreen/tests/test-cli.sh

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ else
3838
./mongosh-dl --version 2.1.1 --out ${DOWNLOAD_DIR} --strip-path-components 1
3939
fi
4040

41+
# Ensure that we can use a downloaded mongodb directory.
42+
rm -rf ${DOWNLOAD_DIR}
43+
bash install-cli.sh "$(pwd)/orchestration"
44+
./mongodl --edition enterprise --version 7.0 --component archive --out ${DOWNLOAD_DIR} --strip-path-components 2
45+
./orchestration/drivers-orchestration run --existing-binaries-dir=${DOWNLOAD_DIR}
46+
${DOWNLOAD_DIR}/mongod --version | grep v7.0
47+
./orchestration/drivers-orchestration stop
48+
4149
if [ ${1:-} == "partial" ]; then
4250
popd
4351
make -C ${DRIVERS_TOOLS} test

0 commit comments

Comments
 (0)