Commit d67d5793 authored by Robert Schmidt's avatar Robert Schmidt

Add push image with tag prefix

The only currently viable way to push ARM images to our registry is to
use a custom tag prefix. Modify the python test code to specify such a
tag, and default to "" (no prefix).
parent 3e823b25
......@@ -726,9 +726,9 @@ class Containerize():
HTML.CreateHtmlTabFooter(False)
return False
def Push_Image_to_Local_Registry(self, HTML, svr_id):
def Push_Image_to_Local_Registry(self, HTML, svr_id, tag_prefix=""):
lIpAddr, lSourcePath = self.GetCredentials(svr_id)
logging.debug('Pushing images from server: ' + lIpAddr)
logging.debug('Pushing images to server: ' + lIpAddr)
ssh = cls_cmd.getConnection(lIpAddr)
imagePrefix = 'porcepix.sboai.cs.eurecom.fr'
ret = ssh.run(f'docker login -u oaicicd -p oaicicd {imagePrefix}')
......@@ -743,7 +743,7 @@ class Containerize():
if self.ranAllowMerge:
orgTag = 'ci-temp'
for image in IMAGES:
tagToUse = CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge)
tagToUse = tag_prefix + CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge)
imageTag = f"{image}:{tagToUse}"
ret = ssh.run(f'docker image tag {image}:{orgTag} {imagePrefix}/{imageTag}')
if ret.returncode != 0:
......@@ -757,9 +757,10 @@ class Containerize():
return False
# Creating a develop tag on the local private registry
if not self.ranAllowMerge:
ssh.run(f'docker image tag {image}:{orgTag} {imagePrefix}/{image}:develop')
ssh.run(f'docker push {imagePrefix}/{image}:develop')
ssh.run(f'docker rmi {imagePrefix}/{image}:develop')
devTag = f"{tag_prefix}develop"
ssh.run(f'docker image tag {image}:{orgTag} {imagePrefix}/{image}:{devTag}')
ssh.run(f'docker push {imagePrefix}/{image}:{devTag}')
ssh.run(f'docker rmi {imagePrefix}/{image}:{devTag}')
ssh.run(f'docker rmi {imagePrefix}/{imageTag} {image}:{orgTag}')
ret = ssh.run(f'docker logout {imagePrefix}')
......
......@@ -387,7 +387,8 @@ def ExecuteActionWithParam(action):
elif action == 'Push_Local_Registry':
svr_id = test.findtext('svr_id')
success = CONTAINERS.Push_Image_to_Local_Registry(HTML, svr_id)
tag_prefix = test.findtext('tag_prefix') or ""
success = CONTAINERS.Push_Image_to_Local_Registry(HTML, svr_id, tag_prefix)
elif action == 'Pull_Local_Registry' or action == 'Clean_Test_Server_Images':
if force_local:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment