Commit 28fb8fbd authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): post-review changes and fix on the HTML reporting

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent a1f1d654
...@@ -580,7 +580,7 @@ class Containerize(): ...@@ -580,7 +580,7 @@ class Containerize():
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.open(lIpAddr, lUserName, lPassWord)
mySSH.command('echo oaicicd | docker login --password-stdin -u oaicicd porcepix.sboai.cs.eurecom.fr', '\$', 5) mySSH.command('docker login -u oaicicd -p oaicicd porcepix.sboai.cs.eurecom.fr', '\$', 5)
if re.search('Login Succeeded', mySSH.getBefore()) is None: if re.search('Login Succeeded', mySSH.getBefore()) is None:
msg = 'Could not log into local registry' msg = 'Could not log into local registry'
logging.error(msg) logging.error(msg)
...@@ -645,7 +645,7 @@ class Containerize(): ...@@ -645,7 +645,7 @@ class Containerize():
else: else:
logging.debug('Pulling images locally') logging.debug('Pulling images locally')
cmd = 'echo oaicicd | docker login --password-stdin -u oaicicd porcepix.sboai.cs.eurecom.fr' cmd = 'docker login -u oaicicd -p oaicicd porcepix.sboai.cs.eurecom.fr'
if lIpAddr != 'none': if lIpAddr != 'none':
mySSH.command(cmd, '\$', 5) mySSH.command(cmd, '\$', 5)
response = mySSH.getBefore() response = mySSH.getBefore()
...@@ -762,7 +762,7 @@ class Containerize(): ...@@ -762,7 +762,7 @@ class Containerize():
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.open(lIpAddr, lUserName, lPassWord)
CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge)
mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5)
...@@ -810,10 +810,20 @@ class Containerize(): ...@@ -810,10 +810,20 @@ class Containerize():
else: else:
time.sleep(10) time.sleep(10)
cnt += 1 cnt += 1
mySSH.command(f'docker inspect -f "{{.Config.Image}}" {containerName}', '\$', 5) mySSH.command('docker inspect --format="ImageUsed: {{.Config.Image}}" ' + containerName, '\$', 5)
usedImage = str(mySSH.getBefore()).strip() for stdoutLine in mySSH.getBefore().split('\n'):
mySSH.command(f'docker image inspect --format "* Size = {{.Size}} bytes\n* Creation = {{.Created}}\n* Id = {{.Id}}" {usedImage}', '\$', 5) if stdoutLine.count('ImageUsed: porcepix'):
imageInfo = str(mySSH.getBefore()) usedImage = stdoutLine.replace('ImageUsed: porcepix', 'porcepix').strip()
logging.debug('Used image is ' + usedImage)
if usedImage != '':
mySSH.command('docker image inspect --format "* Size = {{.Size}} bytes\n* Creation = {{.Created}}\n* Id = {{.Id}}" ' + usedImage, '\$', 5, silent=True)
for stdoutLine in mySSH.getBefore().split('\n'):
if re.search('Size = [0-9]', stdoutLine) is not None:
imageInfo += stdoutLine.strip() + '\n'
if re.search('Creation = [0-9]', stdoutLine) is not None:
imageInfo += stdoutLine.strip() + '\n'
if re.search('Id = sha256', stdoutLine) is not None:
imageInfo += stdoutLine.strip() + '\n'
logging.debug(' -- ' + str(healthyNb) + ' healthy container(s)') logging.debug(' -- ' + str(healthyNb) + ' healthy container(s)')
logging.debug(' -- ' + str(unhealthyNb) + ' unhealthy container(s)') logging.debug(' -- ' + str(unhealthyNb) + ' unhealthy container(s)')
logging.debug(' -- ' + str(startingNb) + ' still starting container(s)') logging.debug(' -- ' + str(startingNb) + ' still starting container(s)')
...@@ -846,7 +856,7 @@ class Containerize(): ...@@ -846,7 +856,7 @@ class Containerize():
html_queue = SimpleQueue() html_queue = SimpleQueue()
html_cell = '<pre style="background-color:white">\n' html_cell = '<pre style="background-color:white">\n'
if usedImage != '': if usedImage != '':
html_cell += f'Used Image = {usedImage}:\n' html_cell += f'Used Image = {usedImage} :\n'
html_cell += imageInfo html_cell += imageInfo
else: else:
html_cell += 'Could not retrieve used image info!\n' html_cell += 'Could not retrieve used image info!\n'
......
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