Skip to content

Commit

Permalink
Merge pull request #9767 from vavuthu/oc_client_based_on_glibc
Browse files Browse the repository at this point in the history
support for RHEL8 builders
  • Loading branch information
petr-balogh authored May 9, 2024
2 parents d8b7fee + 326efcd commit b59b202
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,16 +1183,37 @@ def get_openshift_mirror_url(file_name, version):
UnsupportedOSType: In case the OS type is not supported
UnavailableBuildException: In case the build url is not reachable
"""
target_arch = ""
rhel_version = ""
arch = get_architecture_host()
log.debug(f"Host architecture: {arch}")
if platform.system() == "Darwin":
os_type = "mac"
elif platform.system() == "Linux":
os_type = "linux"
# form the target architecture and rhel version to download oc
if "openshift-client" in file_name:
# form the target architecture to download oc
if "x86_64" in arch:
target_arch = "-amd64"
elif "arm" in arch or "aarch" in arch:
target_arch = "-arm64"
elif "ppc" in arch:
target_arch = "-ppc64le"

glibc_version = get_glibc_version()
if version_module.get_semantic_version(
glibc_version
) < version_module.get_semantic_version("2.34"):
rhel_version = "-rhel8"
else:
rhel_version = "-rhel9"
else:
raise UnsupportedOSType
url_template = config.DEPLOYMENT.get(
"ocp_url_template",
"https://openshift-release-artifacts.apps.ci.l2s4.p1.openshiftapps.com/"
"{version}/{file_name}-{os_type}-{version}.tar.gz",
f"{version}/{file_name}-{os_type}{target_arch}{rhel_version}-{version}.tar.gz",
)
url = url_template.format(
version=version,
Expand Down Expand Up @@ -4840,3 +4861,14 @@ def get_glibc_version():
return version_match.group(1)
else:
log.warning("GLIBC version number not found")


def get_architecture_host():
"""
Gets the architecture of host
Returns:
str: Host architecture
"""
return os.uname().machine

0 comments on commit b59b202

Please sign in to comment.