Commit e1361431 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Add constant for list of images in cls_containerize

parent 19514381
...@@ -53,10 +53,13 @@ import sshconnection as SSH ...@@ -53,10 +53,13 @@ import sshconnection as SSH
import helpreadme as HELP import helpreadme as HELP
import constants as CONST import constants as CONST
import cls_oaicitest import cls_oaicitest
#----------------------------------------------------------- #-----------------------------------------------------------
# Helper functions used here and in other classes # Helper functions used here and in other classes
# (e.g., cls_cluster.py) # (e.g., cls_cluster.py)
#----------------------------------------------------------- #-----------------------------------------------------------
IMAGES = ['oai-enb', 'oai-lte-ru', 'oai-lte-ue', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue']
def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge): def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge):
if ranCommitID == '': if ranCommitID == '':
logging.error('need ranCommitID in CreateWorkspace()') logging.error('need ranCommitID in CreateWorkspace()')
...@@ -800,8 +803,7 @@ class Containerize(): ...@@ -800,8 +803,7 @@ class Containerize():
logging.debug('Removing test images locally') logging.debug('Removing test images locally')
myCmd = cls_cmd.LocalCmd() myCmd = cls_cmd.LocalCmd()
imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup', 'oai-gnb-aw2s'] for image in IMAGES:
for image in imageNames:
imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
cmd = f'docker rmi oai-ci/{imageTag}' cmd = f'docker rmi oai-ci/{imageTag}'
myCmd.run(cmd, reportNonZero=False) myCmd.run(cmd, reportNonZero=False)
...@@ -838,8 +840,7 @@ class Containerize(): ...@@ -838,8 +840,7 @@ class Containerize():
mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5)
mySSH.command('cp docker-compose.y*ml ci-docker-compose.yml', '\$', 5) mySSH.command('cp docker-compose.y*ml ci-docker-compose.yml', '\$', 5)
imagesList = ['oai-enb', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue'] for image in IMAGES:
for image in imagesList:
imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
mySSH.command(f'sed -i -e "s#image: {image}:latest#image: oai-ci/{imageTag}#" ci-docker-compose.yml', '\$', 2) mySSH.command(f'sed -i -e "s#image: {image}:latest#image: oai-ci/{imageTag}#" ci-docker-compose.yml', '\$', 2)
localMmeIpAddr = EPC.MmeIPAddress localMmeIpAddr = EPC.MmeIPAddress
...@@ -1005,7 +1006,7 @@ class Containerize(): ...@@ -1005,7 +1006,7 @@ class Containerize():
HTML.htmleNBFailureMsg='Could not copy logfile to analyze it!' HTML.htmleNBFailureMsg='Could not copy logfile to analyze it!'
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.exitStatus = 1 self.exitStatus = 1
# use function for UE log analysis, when oai-nr-ue container is used # use function for UE log analysis, when oai-nr-ue container is used
elif 'oai-nr-ue' in services: elif 'oai-nr-ue' in services:
self.exitStatus == 0 self.exitStatus == 0
logging.debug('\u001B[1m Analyzing UE logfile ' + filename + ' \u001B[0m') logging.debug('\u001B[1m Analyzing UE logfile ' + filename + ' \u001B[0m')
...@@ -1198,8 +1199,7 @@ class Containerize(): ...@@ -1198,8 +1199,7 @@ class Containerize():
myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0]) myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0])
cmd = 'cp docker-compose.y*ml docker-compose-ci.yml' cmd = 'cp docker-compose.y*ml docker-compose-ci.yml'
myCmd.run(cmd, silent=self.displayedNewTags) myCmd.run(cmd, silent=self.displayedNewTags)
imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] for image in IMAGES:
for image in imageNames:
tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml' cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml'
myCmd.run(cmd, silent=self.displayedNewTags) myCmd.run(cmd, silent=self.displayedNewTags)
......
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