diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index ace1545fbc..53164a2d55 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -414,20 +414,16 @@ class Cluster: # Analyze the logs collectInfo = {} for image, lf in log_files: - files = {} - idx = 'Target Image Creation' - files[idx] = cls_containerize.AnalyzeBuildLogs(image, lf) - status = status and files[idx]['status'] - collectInfo[image] = files + ret = cls_containerize.AnalyzeBuildLogs(image, lf) + imgStatus = ret['status'] + msg = f"size {imageSize[image]}, analysis of {os.path.basename(lf)}: {ret['errors']} errors, {ret['warnings']} warnings" + HTML.CreateHtmlTestRowQueue(image, 'OK' if imgStatus else 'KO', [msg]) + status = status and imgStatus if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') - HTML.CreateHtmlTestRow('all', 'OK', CONST.ALL_PROCESSES_OK) else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') - HTML.CreateHtmlTestRow('all', 'KO', CONST.ALL_PROCESSES_OK) - - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, imageSize) # TODO fix groovy script, remove the following. # the groovy scripts expects all logs in diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 9af086308a..c006951908 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -462,25 +462,18 @@ class Containerize(): cmd.close() # Analyze the logs - collectInfo = {} for name, lf in log_files: - files = {} - idx = 'Target Image Creation' - files[idx] = AnalyzeBuildLogs(name, lf) - status = status and files[idx]['status'] - collectInfo[name] = files + ret = AnalyzeBuildLogs(name, lf) + imgStatus = ret['status'] + msg = f"size {allImagesSize[name]}, analysis of {os.path.basename(lf)}: {ret['errors']} errors, {ret['warnings']} warnings" + HTML.CreateHtmlTestRowQueue(name, 'OK' if imgStatus else 'KO', [msg]) + status = status and imgStatus if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) - return True else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') - HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) - HTML.CreateHtmlTabFooter(False) - return False + return status def BuildProxy(self, ctx, HTML): svr = self.eNB_serverId[self.eNB_instance] @@ -545,16 +538,6 @@ class Containerize(): self.ranAllowMerge = oldRanAllowMerge self.ranTargetBranch = oldRanTargetBranch - # we do not analyze the logs (we assume the proxy builds fine at this stage), - # but need to have the following information to correctly display the HTML - files = {} - errorandwarnings = {} - errorandwarnings['errors'] = 0 - errorandwarnings['warnings'] = 0 - errorandwarnings['status'] = True - files['Target Image Creation'] = errorandwarnings - collectInfo = {} - collectInfo['proxy'] = files ret = ssh.run(f'docker image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') result = re.search(r'Size *= *(?P[0-9\-]+) *bytes', ret.stdout) # Cleaning any created tmp volume @@ -568,14 +551,12 @@ class Containerize(): allImagesSize['proxy'] = str(round(imageSize,1)) + ' Mbytes' logging.info('\u001B[1m Building L2sim Proxy Image Pass\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) return True else: logging.error('proxy size is unknown') allImagesSize['proxy'] = 'unknown' logging.error('\u001B[1m Build of L2sim proxy failed\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlTabFooter(False) return False def BuildRunTests(self, ctx, HTML): diff --git a/ci-scripts/cls_oai_html.py b/ci-scripts/cls_oai_html.py index 07226bcff3..c4e13b2e62 100644 --- a/ci-scripts/cls_oai_html.py +++ b/ci-scripts/cls_oai_html.py @@ -332,58 +332,6 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.close() - - def CreateHtmlNextTabHeaderTestRow(self, collectInfo, allImagesSize, machine='eNB'): - if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): - return - self.htmlFile = open('test_results.html', 'a') - if bool(collectInfo) == False: - self.htmlFile.write(' \n') - self.htmlFile.write(' ----IMAGES BUILDING FAILED - Unable to recover the image logs ---- \n') - self.htmlFile.write(' \n') - else: - for image in collectInfo: - files = collectInfo[image] - # TabHeader for image logs on built shared and target images - if allImagesSize[image].count('unknown') > 0: - self.htmlFile.write(' \n') - elif allImagesSize[image].count('Build Failed') > 0: - self.htmlFile.write(' \n') - else: - self.htmlFile.write(' \n') - self.htmlFile.write(' ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' \n') - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') - self.htmlFile.write(' Element\n') - self.htmlFile.write(' Nb Errors\n') - self.htmlFile.write(' Nb Warnings\n') - self.htmlFile.write(' Status\n') - self.htmlFile.write(' \n') - - for fil in files: - parameters = files[fil] - # TestRow for image logs on built shared and target images - self.htmlFile.write(' \n') - self.htmlFile.write(' ' + fil + ' \n') - if (parameters['errors'] == 0): - self.htmlFile.write(' ' + str(parameters['errors']) + '\n') - else: - self.htmlFile.write(' ' + str(parameters['errors']) + '\n') - if (parameters['errors'] > 0): - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') - elif (parameters['warnings'] == 0): - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') - else: - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') - if (parameters['errors'] == 0) and (parameters['warnings'] == 0): - self.htmlFile.write(' OK \n') - elif (parameters['errors'] == 0): - self.htmlFile.write(' OK \n') - else: - self.htmlFile.write(' NOT OK \n') - self.htmlFile.write(' \n') - self.htmlFile.close() - #for the moment it is limited to 4 columns, to be made generic later def CreateHtmlDataLogTable(self, DataLog): if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):