Skip to content

Commit 70d56ca

Browse files
authored
Fix latest-build URL for RHEL (#603)
1 parent 8c61192 commit 70d56ca

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.evergreen/mongodl.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,12 @@ def _published_build_url(
767767

768768

769769
def _latest_build_url(
770-
target: str, arch: str, edition: str, component: str, branch: "str|None"
770+
cache: Cache,
771+
target: str,
772+
arch: str,
773+
edition: str,
774+
component: str,
775+
branch: "str|None",
771776
) -> str:
772777
"""
773778
Get the URL for an "unpublished" "latest" build.
@@ -796,6 +801,15 @@ def _latest_build_url(
796801
ext = "zip" if target == "windows" else "tgz"
797802
# Enterprise builds have an "enterprise" infix
798803
ent_infix = "enterprise-" if edition == "enterprise" else ""
804+
if "rhel" in target:
805+
# Some RHEL targets include a minor version, like "rhel93". Check the URL of the latest release.
806+
latest_release_url = _published_build_url(
807+
cache, "latest", target, arch, edition, component
808+
)
809+
got = re.search(r"rhel[0-9][0-9]", latest_release_url)
810+
if got is not None:
811+
# Rewrite target like "rhel9" to "rhel93" to match published URL.
812+
target = got.group(0)
799813
# Some platforms have a filename infix
800814
tgt_infix = (target + "-") if target not in ("windows", "win32", "macos") else ""
801815
# Non-master branch uses a filename infix
@@ -823,7 +837,7 @@ def _dl_component(
823837
LOGGER.info(f"Download {component} {version}-{edition} for {target}-{arch}")
824838
if version == "latest-build":
825839
dl_url = _latest_build_url(
826-
target, arch, edition, component, latest_build_branch
840+
cache, target, arch, edition, component, latest_build_branch
827841
)
828842
else:
829843
try:

.evergreen/tests/test-cli.sh

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export VALIDATE_DISTROS=1
6565
./mongodl --edition enterprise --version 8.0 --component archive --test
6666
./mongodl --edition enterprise --version rapid --component archive --test
6767
./mongodl --edition enterprise --version latest --component archive --out ${DOWNLOAD_DIR}
68+
./mongodl --edition enterprise --version latest-build --component archive --test
6869
./mongodl --edition enterprise --version v6.0-perf --component cryptd --test
6970
./mongodl --edition enterprise --version v8.0-perf --component cryptd --test
7071

0 commit comments

Comments
 (0)