Commit 451199f5 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'ci_better_html_headers' into 'develop'

CI: CN5G HTML reports have now a build summary header

See merge request oai/cn5g/oai-cn5g-amf!4
parents 54f38bb0 f80b8d2e
...@@ -90,60 +90,90 @@ class HtmlReport(): ...@@ -90,60 +90,90 @@ class HtmlReport():
self.file.write(' <br>\n') self.file.write(' <br>\n')
# Build Info Summary # Build Info Summary
self.file.write(' <table class="table-bordered" width = "80%" align = "center" border = "1">\n') buildSummary = ''
self.file.write(' <tr>\n') buildSummary += ' <table class="table-bordered" width = "80%" align = "center" border = "1">\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n') buildSummary += ' <tr>\n'
buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n'
#date_formatted = re.sub('\..*', '', self.created) #date_formatted = re.sub('\..*', '', self.created)
self.file.write(' <td>' + self.job_start_time + '</td>\n') buildSummary += ' <td>' + self.job_start_time + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td>Pull Request</td>\n') buildSummary += ' <td>Pull Request</td>\n'
else: else:
self.file.write(' <td>Push Event</td>\n') buildSummary += ' <td>Push Event</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n'
self.file.write(' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n') buildSummary += ' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n'
self.file.write(' <td>' + self.git_target_branch + '</td>\n') buildSummary += ' <td>' + self.git_target_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n'
self.file.write(' <td>' + self.git_target_commit + '</td>\n') buildSummary += ' <td>' + self.git_target_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
else: else:
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' </table>\n') buildSummary += ' </table>\n'
self.file.write(' <br>\n') buildSummary += ' <br>\n'
self.file.write(buildSummary)
cwd = os.getcwd()
if os.path.isfile(cwd + '/ds_tester_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/ds_tester_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/ds_tester_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('DS Tester Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/ds_tester_results_oai_cn5g_new.html', cwd + '/ds_tester_results_oai_cn5g.html')
if os.path.isfile(cwd + '/deploy_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/deploy_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/deploy_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('Deployment Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/deploy_results_oai_cn5g_new.html', cwd + '/deploy_results_oai_cn5g.html')
def generateFooter(self): def generateFooter(self):
self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n') self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\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