diff --git a/ocs_ci/deployment/acm.py b/ocs_ci/deployment/acm.py index b02b49aa0b71..04b46c78d8f7 100644 --- a/ocs_ci/deployment/acm.py +++ b/ocs_ci/deployment/acm.py @@ -18,7 +18,11 @@ ) from ocs_ci.utility import templating from ocs_ci.ocs.utils import get_non_acm_cluster_config -from ocs_ci.utility.utils import run_cmd, run_cmd_interactive +from ocs_ci.utility.utils import ( + run_cmd, + run_cmd_interactive, + wait_for_machineconfigpool_status, +) from ocs_ci.ocs.node import get_typed_worker_nodes, label_nodes logger = logging.getLogger(__name__) @@ -117,6 +121,7 @@ def create_acm_brew_icsp(self): ) templating.dump_data_to_temp_yaml(icsp_data, icsp_data_yaml.name) run_cmd(f"oc create -f {icsp_data_yaml.name}", timeout=300) + wait_for_machineconfigpool_status(node_type="all") def download_binary(self): if self.source == "upstream": diff --git a/ocs_ci/ocs/acm/acm.py b/ocs_ci/ocs/acm/acm.py index 69555d1e3bde..0fb71fe5cbbf 100644 --- a/ocs_ci/ocs/acm/acm.py +++ b/ocs_ci/ocs/acm/acm.py @@ -2,6 +2,7 @@ import time import os import tempfile +import requests from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as ec @@ -23,9 +24,9 @@ from ocs_ci.ocs.utils import get_non_acm_cluster_config, get_primary_cluster_config from ocs_ci.utility.utils import ( TimeoutSampler, + get_ocp_version, get_running_acm_version, string_chunkify, - chained_subprocess_pipes, run_cmd, ) from ocs_ci.ocs.ui.acm_ui import AcmPageNavigator @@ -167,28 +168,20 @@ def install_submariner_ui(self, globalnet=True): config.ENV_DATA["submariner_version"], ] ) - curl_cmd = f"curl --retry 3 --retry-delay 5 -Ls {submariner_full_url}" - jq_cmd1 = ( - 'jq -r \'[.raw_messages[].msg | select(.pipeline.status=="complete") |' - "{{nvr: .artifact.nvr, index_image: .pipeline.index_image}}] | .[0]'" - ) - jq_cmd2 = "jq -r '.index_image.\"v4.14\"'" - cut_cmd1 = "cut -d'/' -f3-" - cut_cmd2 = "cut -d':' -f2-" - cmd_exec = chained_subprocess_pipes( - [curl_cmd, jq_cmd1, jq_cmd2, cut_cmd1, cut_cmd2] + resp = requests.get(submariner_full_url, verify=False) + raw_msg = resp.json()["raw_messages"] + version_tag = raw_msg[0]["msg"]["pipeline"]["index_image"][ + f"v{get_ocp_version()}" + ].split(":")[1] + submariner_downstream_unreleased["spec"]["image"] = ":".join( + [constants.SUBMARINER_BREW_REPO, version_tag] ) - version_tag = cmd_exec.communicate()[0].decode() - - image_url = submariner_downstream_unreleased["spec"]["image"] - image_url = image_url.replace("PLACE_HOLDER", version_tag) - submariner_downstream_unreleased["spec"]["image"] = image_url submariner_data_yaml = tempfile.NamedTemporaryFile( mode="w+", prefix="submariner_downstream_unreleased", delete=False ) templating.dump_data_to_temp_yaml( - submariner_downstream_unreleased, submariner_data_yaml + submariner_downstream_unreleased, submariner_data_yaml.name ) old_ctx = config.cur_index for cluster in get_non_acm_cluster_config(): diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index 22c1e05cac57..f4c6313e7dde 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -2079,6 +2079,7 @@ "VirtualTopic.eng.ci.redhat-container-image.pipeline.complete" "&rows_per_page=25&delta=1296000&contains=submariner-operator-bundle-container-v" ) +SUBMARINER_BREW_REPO = "brew.registry.redhat.io/rh-osbs/iib" # Multicluster related diff --git a/ocs_ci/templates/ocs-deployment/multicluster/submariner_downstream_unreleased_catsrc.yaml b/ocs_ci/templates/ocs-deployment/multicluster/submariner_downstream_unreleased_catsrc.yaml index bab28efe1df8..b931afe2ce89 100644 --- a/ocs_ci/templates/ocs-deployment/multicluster/submariner_downstream_unreleased_catsrc.yaml +++ b/ocs_ci/templates/ocs-deployment/multicluster/submariner_downstream_unreleased_catsrc.yaml @@ -7,7 +7,7 @@ spec: icon: base64data: "" mediatype: "" - image: brew.registry.redhat.io/rh-osbs/iib:PLACE_HOLDER + image: PLACE_HOLDER publisher: Red Hat sourceType: grpc priority: 100 diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 94cd8b3de5b9..a85aead0163c 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -4553,30 +4553,3 @@ def is_cluster_y_version_upgraded(): ) > version_module.get_semantic_version(prev_version_num, only_major_minor=True): is_upgraded = True return is_upgraded - - -def chained_subprocess_pipes(cmd_list): - """ - We can use this function wherever we have chain of commands which - need to be piped. Direct shell piping has some parsing issues hence implementing - this using subprocess output redirections which mimics shell pipes. - Commands will be run as per the command ordering inside the list and output of - each command will be fed as input to the next command in the list - - - Args: - cmd_list (list): list of commands to be run whose output need to be piped - - Returns: - Popen object of the last command executed - - """ - pipe_buf = None - for cmd in cmd_list: - if not pipe_buf: - pipe_buf = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) - else: - pipe_buf = subprocess.Popen( - shlex.split(cmd), stdin=pipe_buf.stdout, stdout=subprocess.PIPE - ) - return pipe_buf