SERVER-92939 Route tools download to the newest rhel version (#25595) (#25769)

(cherry picked from commit c3f828ae4afafd7d03661beb3f44e41958cb3320)

The tools binaries only are published for one minor version per major
version of RHEL. When the db tools team added rhel88 and rhel93 versions
of the binaries, they stopped publishing rhel80 (amd64), rhel82 (arm64),
and rhel90 versions.

Route the package tester to instead pull down the latest rhel version
that matches the major rhel version of the package (ex. rhel80 package
-> rhel88 tools)

This will be compatible because the tools binaries do not depend on any
system libraries that are not guaranteed to be compatible across minor
versions (per
https://access.redhat.com/articles/rhel8-abi-compatibility#Guidelines):

```
linux-vdso.so.1 [compat 1 via krb]
libresolv.so.2 [compat 1 via libc]
libpthread.so.0 [compat 1 via libc]
libgssapi_krb5.so.2  [compat 1 via krb]
libkrb5.so.3 [compat 1]
libc.so.6 [compat 1]
/lib/ld-linux-aarch64.so.1 [compat 1 via krb]
libk5crypto.so.3 [compat 1 via krb]
libcom_err.so.2 [compat 1 via krb]
libkrb5support.so.0 [compat 1 via krb]
libkeyutils.so.1 [compat 1 via krb]
```

GitOrigin-RevId: 841501a467c85eb853c7540695bec55fdbd25380
This commit is contained in:
Zack Winter 2024-08-05 14:54:01 -07:00 committed by MongoDB Bot
parent 86fc156ab1
commit 81c102cee4
1 changed files with 11 additions and 1 deletions

View File

@ -342,8 +342,18 @@ def get_tools_package(arch_name: str, os_name: str) -> Optional[str]:
if arch_name == "aarch64" and not os_name.startswith("amazon") and not os_name.startswith(
"rhel"):
arch_name = "arm64"
# Tools packages are only published to the latest RHEL version supported on master, but
# the tools binaries are cross compatible with other RHEL versions
# (see https://jira.mongodb.org/browse/SERVER-92939)
def major_version_matches(download_name: str) -> bool:
if (os_name.startswith("rhel") and download_name.startswith("rhel")
and os_name[4] == download_name[4]):
return True
return download_name == os_name
for download in current_tools_releases["versions"][0]["downloads"]:
if download["name"] == os_name and download["arch"] == arch_name:
if major_version_matches(download["name"]) and download["arch"] == arch_name:
return download["package"]["url"]
return None