From 063b56f22f9a09293865a29e8f3b7792ec8aed53 Mon Sep 17 00:00:00 2001 From: Shylesh Kumar Mohan Date: Wed, 1 Jan 2025 12:19:46 +0530 Subject: [PATCH] Skip subctl download during deployment in case of downstream unreleased Signed-off-by: Shylesh Kumar Mohan --- ocs_ci/deployment/acm.py | 22 ++++++++++++++-------- ocs_ci/ocs/constants.py | 2 +- tests/conftest.py | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ocs_ci/deployment/acm.py b/ocs_ci/deployment/acm.py index 96aa8d491cb..2b88b833041 100644 --- a/ocs_ci/deployment/acm.py +++ b/ocs_ci/deployment/acm.py @@ -9,6 +9,7 @@ import shutil import requests import subprocess +import re import semantic_version import platform @@ -86,8 +87,11 @@ def __init__(self): self.dr_only_list = [] def deploy(self): - # Download subctl binary in any case. - self.download_binary() + # Download subctl binary in any case except downstream unreleased. + if not ( + self.source == "downstream" and self.submariner_release_type == "unreleased" + ): + self.download_binary() if self.source == "upstream": self.deploy_upstream() elif self.source == "downstream": @@ -173,7 +177,7 @@ def get_submariner_csv_version(self): """ csv_version_cmd = ( "oc get submariners.submariner.io -n submariner-operator " - "submariner -o jsonpath='{{.status.gateways[0].version}}'" + "submariner -o jsonpath='{.status.gateways[0].version}'" ) return run_cmd(csv_version_cmd) @@ -186,12 +190,12 @@ def get_submariner_unreleased_tag(self, subctl_version): f"curl --retry 3 --retry-delay 5 -Ls " f'"https://datagrepper.engineering.redhat.com/raw?' f"topic=/topic/VirtualTopic.eng.ci.redhat-container-image.pipeline.complete&" - f'rows_per_page=25&delta=1296000&contains=subctl-container-{subctl_version}"|' + f'rows_per_page=25&delta=12960000&contains=subctl-container-{subctl_version}"|' f'jq -r \'[.raw_messages[].msg | select(.pipeline.status=="complete") | ' f"{{nvr: .artifact.nvr, index_image: .artifact.image_tag}}] | .[0]' | " f"jq -r '.index_image' |cut -d'/' -f3- |cut -d':' -f2-" ) - return run_cmd(cmd) + return run_cmd(cmd, shell=True) def download_downstream_binary(self): """ @@ -201,10 +205,10 @@ def download_downstream_binary(self): UnsupportedPlatformError : If current platform has no supported subctl binary """ if self.submariner_release_type == "unreleased": - subctl_ver = self.get_submariner_csv_version() + version_str = self.get_submariner_csv_version() else: subctl_ver = config.ENV_DATA["subctl_version"] - version_str = subctl_ver.split(":")[1] + version_str = subctl_ver.split(":")[1] pull_secret_path = os.path.join(constants.DATA_DIR, "pull-secret") processor = platform.processor() arch = platform.machine() @@ -217,7 +221,9 @@ def download_downstream_binary(self): "Not a supported architecture for subctl binary" ) if self.submariner_release_type == "unreleased": - unreleased_tag = self.get_submariner_unreleased_tag(subctl_ver) + unreleased_tag = self.get_submariner_unreleased_tag( + re.match(r"(v\d+\.\d+)", version_str).group(1) + ) brew_url = "/".join([constants.SUBMARINER_BREW, "rhacm2-subctl-rhel9:"]) cmd = ( f"oc image extract --filter-by-os linux/{binary_pltfrm} " diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index 3cfe52b3ccb..2e7e573ab17 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -2721,7 +2721,7 @@ SUBMARINER_DOWNSTREAM_UNRELEASED_BUILD_URL = ( "https://datagrepper.engineering.redhat.com/raw?topic=/topic/" "VirtualTopic.eng.ci.redhat-container-image.pipeline.complete" - "&rows_per_page=25&delta=1296000&contains=submariner-operator-bundle-container-v" + "&rows_per_page=25&delta=12960000&contains=submariner-operator-bundle-container-v" ) ACM_BREW_BUILD_URL = ( "https://datagrepper.engineering.redhat.com/raw?topic=/topic/" diff --git a/tests/conftest.py b/tests/conftest.py index 5ce8c3d8c6e..9191cb64bbd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -357,7 +357,7 @@ def pytest_generate_tests(metafunc): """ # For now we are only dealing with multicluster scenarios in this hook - if ocsci_config.multicluster: + if ocsci_config.multicluster and ocsci_config.UPGRADE.get("upgrade", False): upgrade_parametrizer = get_multicluster_upgrade_parametrizer() # for various roles which are applicable to current test wrt multicluster, for ex: ACM, primary, secondary etc roles = None