diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 7293e252a1..3044d3276c 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -226,7 +226,7 @@ class Cluster: def _undeploy_pod(self, filename): self.cmd.run(f'oc delete -f {filename}') - def PullClusterImage(self, HTML, node, images): + def PullClusterImage(self, HTML, node, images, tag_prefix): logging.debug(f'Pull OC image {images} to server {node}') self.testCase_id = HTML.testCase_id with cls_cmd.getConnection(node) as cmd: @@ -242,7 +242,7 @@ class Cluster: return False tag = cls_containerize.CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge) registry = f'{self.OCRegistry}/{CI_OC_RAN_NAMESPACE}' - success, msg = cls_containerize.Containerize.Pull_Image(cmd, images, tag, registry, None, None) + success, msg = cls_containerize.Containerize.Pull_Image(cmd, images, tag, tag_prefix, registry, None, None) OC_logout(cmd) param = f"on node {node}" if success: diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index aa29da000e..dc461dfe7e 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -775,7 +775,7 @@ class Containerize(): HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) return True - def Pull_Image(cmd, images, tag, registry, username, password): + def Pull_Image(cmd, images, tag, tag_prefix, registry, username, password): if username is not None and password is not None: logging.info(f"logging into registry {username}@{registry}") response = cmd.run(f'docker login -u {username} -p {password} {registry}', silent=True, reportNonZero=False) @@ -785,14 +785,15 @@ class Containerize(): return False, msg pulled_images = [] for image in images: + imagePrefTag = f"{image}:{tag_prefix}{tag}" imageTag = f"{image}:{tag}" - response = cmd.run(f'docker pull {registry}/{imageTag}') + response = cmd.run(f'docker pull {registry}/{imagePrefTag}') if response.returncode != 0: - msg = f'Could not pull {image} from local registry: {imageTag}' + msg = f'Could not pull {image} from local registry: {imagePrefTag}' logging.error(msg) return False, msg - cmd.run(f'docker tag {registry}/{imageTag} oai-ci/{imageTag}') - cmd.run(f'docker rmi {registry}/{imageTag}') + cmd.run(f'docker tag {registry}/{imagePrefTag} oai-ci/{imageTag}') + cmd.run(f'docker rmi {registry}/{imagePrefTag}') pulled_images += [f"oai-ci/{imageTag}"] if username is not None and password is not None: response = cmd.run(f'docker logout {registry}') @@ -800,13 +801,13 @@ class Containerize(): msg = "Pulled Images:\n" + '\n'.join(pulled_images) return True, msg - def Pull_Image_from_Registry(self, HTML, svr_id, images, tag=None, registry="porcepix.sboai.cs.eurecom.fr", username="oaicicd", password="oaicicd"): + def Pull_Image_from_Registry(self, HTML, svr_id, images, tag=None, tag_prefix="", registry="porcepix.sboai.cs.eurecom.fr", username="oaicicd", password="oaicicd"): lIpAddr, lSourcePath = self.GetCredentials(svr_id) logging.debug('\u001B[1m Pulling image(s) on server: ' + lIpAddr + '\u001B[0m') if not tag: tag = CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge) with cls_cmd.getConnection(lIpAddr) as cmd: - success, msg = Containerize.Pull_Image(cmd, images, tag, registry, username, password) + success, msg = Containerize.Pull_Image(cmd, images, tag, tag_prefix, registry, username, password) param = f"on node {lIpAddr}" if success: HTML.CreateHtmlTestRowQueue(param, 'OK', [msg]) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index ebd2252bc6..472cb2665f 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -395,13 +395,14 @@ def ExecuteActionWithParam(action): # Do not pull or remove images when running locally. User is supposed to handle image creation & cleanup return True svr_id = test.findtext('svr_id') + tag_prefix = test.findtext('tag_prefix') or "" images = test.findtext('images').split() # hack: for FlexRIC, we need to overwrite the tag to use tag = None if len(images) == 1 and images[0] == "oai-flexric": tag = CONTAINERS.flexricTag if action == "Pull_Local_Registry": - success = CONTAINERS.Pull_Image_from_Registry(HTML, svr_id, images, tag=tag) + success = CONTAINERS.Pull_Image_from_Registry(HTML, svr_id, images, tag=tag, tag_prefix=tag_prefix) if action == "Clean_Test_Server_Images": success = CONTAINERS.Clean_Test_Server_Images(HTML, svr_id, images, tag=tag) @@ -421,9 +422,10 @@ def ExecuteActionWithParam(action): success = cls_oaicitest.Custom_Script(HTML, node, script, command_fail) elif action == 'Pull_Cluster_Image': + tag_prefix = test.findtext('tag_prefix') or "" images = test.findtext('images').split() node = test.findtext('node') - success = CLUSTER.PullClusterImage(HTML, node, images) + success = CLUSTER.PullClusterImage(HTML, node, images, tag_prefix=tag_prefix) else: logging.warning(f"unknown action {action}, skip step") diff --git a/ci-scripts/xml_files/container_sa_gh_aerial_quectel.xml b/ci-scripts/xml_files/container_sa_gh_aerial_quectel.xml new file mode 100644 index 0000000000..ea60cb2b6f --- /dev/null +++ b/ci-scripts/xml_files/container_sa_gh_aerial_quectel.xml @@ -0,0 +1,49 @@ + + + TEST-GH-AERIAL-SA + Gracehopper AERIAL 100 MHz TDD SA + tasks + + 111111 + 333333 + + + + + Pull_Local_Registry + Pull Images from Local Registry + 0 + oai-gnb-aerial + arm_ + + + + Clean_Test_Server_Images + true + Clean Test Images on Test Server + 0 + oai-gnb-aerial + + +