Commit 285650d3 authored by Raphael Defosseux's avatar Raphael Defosseux

CI: Adding missing reason for image build failure

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 1041a6d8
...@@ -88,6 +88,7 @@ class Containerize(): ...@@ -88,6 +88,7 @@ class Containerize():
self.host = '' self.host = ''
self.allImagesSize = {} self.allImagesSize = {}
self.collectInfo = {} self.collectInfo = {}
#----------------------------------------------------------- #-----------------------------------------------------------
# Container management functions # Container management functions
#----------------------------------------------------------- #-----------------------------------------------------------
...@@ -335,6 +336,31 @@ class Containerize(): ...@@ -335,6 +336,31 @@ class Containerize():
errorandwarnings['warnings'] = warningsNo errorandwarnings['warnings'] = warningsNo
errorandwarnings['status'] = status errorandwarnings['status'] = status
files[fil] = errorandwarnings files[fil] = errorandwarnings
# Let analyze the target image creation part
if os.path.isfile('build_log_{}/{}.log'.format(self.testCase_id,image)):
errorandwarnings = {}
with open('build_log_{}/{}.log'.format(self.testCase_id,image), mode='r') as inputfile:
startOfTargetImageCreation = False
buildStatus = False
for line in inputfile:
result = re.search('FROM .* as ' + image + '$', str(line))
if result is not None:
startOfTargetImageCreation = True
if startOfTargetImageCreation:
result = re.search('Successfully tagged ' + image + ':', str(line))
if result is not None:
buildStatus = True
result = re.search('COMMIT ' + image + ':', str(line))
if result is not None:
buildStatus = True
inputfile.close()
if buildStatus:
errorandwarnings['errors'] = 0
else:
errorandwarnings['errors'] = 1
errorandwarnings['warnings'] = 0
errorandwarnings['status'] = buildStatus
files['Target Image Creation'] = errorandwarnings
self.collectInfo[image] = files self.collectInfo[image] = files
if status: if status:
......
...@@ -412,6 +412,11 @@ class HTMLManagement(): ...@@ -412,6 +412,11 @@ class HTMLManagement():
for image in collectInfo: for image in collectInfo:
files = collectInfo[image] files = collectInfo[image]
# TabHeader for image logs on built shared and target images # TabHeader for image logs on built shared and target images
if allImagesSize[image].count('unknown') > 0:
self.htmlFile.write(' <tr bgcolor = "orange" >\n')
elif allImagesSize[image].count('Build Failed') > 0:
self.htmlFile.write(' <tr bgcolor = "red" >\n')
else:
self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n') self.htmlFile.write(' <tr bgcolor = "#F0F0F0" >\n')
self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '><b> ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' </b></td>\n') self.htmlFile.write(' <td colspan=' + str(5+self.htmlUEConnected) + '><b> ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' </b></td>\n')
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
...@@ -431,7 +436,9 @@ class HTMLManagement(): ...@@ -431,7 +436,9 @@ class HTMLManagement():
self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['errors']) + '</td>\n') self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['errors']) + '</td>\n')
else: else:
self.htmlFile.write(' <td bgcolor = "red" >' + str(parameters['errors']) + '</td>\n') self.htmlFile.write(' <td bgcolor = "red" >' + str(parameters['errors']) + '</td>\n')
if (parameters['warnings'] == 0): if (parameters['errors'] > 0):
self.htmlFile.write(' <td bgcolor = "red" >' + str(parameters['warnings']) + '</td>\n')
elif (parameters['warnings'] == 0):
self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['warnings']) + '</td>\n') self.htmlFile.write(' <td bgcolor = "green" >' + str(parameters['warnings']) + '</td>\n')
elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' <td bgcolor = "orange" >' + str(parameters['warnings']) + '</td>\n') self.htmlFile.write(' <td bgcolor = "orange" >' + str(parameters['warnings']) + '</td>\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