Update CI status report to generate HTML table.
This updates the CI status report so that we generate a tripleo-jobs.html-table that can be used to include the CI status results in an external website. The existing tripleo-jobs.html is still generated like it was before. Change-Id: I97285e147e79efbce3c16bf56e5a1eaa1656c1e4
This commit is contained in:
parent
a4f7707364
commit
285357ba90
|
@ -1,4 +1,5 @@
|
||||||
index.html
|
tripleo-jobs.db
|
||||||
result_cache.html
|
tripleo-jobs.html
|
||||||
|
tripleo-jobs.html-table
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
|
|
|
@ -15,3 +15,4 @@ Tools to help run CI jobs for TripleO. Includes things like:
|
||||||
broker nodes.
|
broker nodes.
|
||||||
* Heat templates to help deploy and maintain test environment nodes
|
* Heat templates to help deploy and maintain test environment nodes
|
||||||
using an undercloud.
|
using an undercloud.
|
||||||
|
* Helper script(s) to generate CI status reports. (tox -ecireport -- -f)
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Job(Base):
|
||||||
url = Column(String)
|
url = Column(String)
|
||||||
|
|
||||||
job_names = [
|
job_names = [
|
||||||
'gate-tripleo-ironic-overcloud-f21-nonha',
|
|
||||||
'gate-tripleo-ironic-overcloud-f21puppet-nonha',
|
'gate-tripleo-ironic-overcloud-f21puppet-nonha',
|
||||||
'gate-tripleo-ironic-overcloud-f21puppet-ha',
|
'gate-tripleo-ironic-overcloud-f21puppet-ha',
|
||||||
'gate-tripleo-ironic-overcloud-f21puppet-ceph',
|
'gate-tripleo-ironic-overcloud-f21puppet-ceph',
|
||||||
|
@ -105,13 +104,13 @@ def get_data(stop_after):
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
|
|
||||||
def gen_html(html_file, stats_hours):
|
def gen_html(html_file, table_file, stats_hours):
|
||||||
refs_done = []
|
refs_done = []
|
||||||
fp = open(html_file, "w")
|
fp = open(table_file, "w")
|
||||||
fp.write('<html><head/><body><table border="1">')
|
fp.write('<table border="1">')
|
||||||
fp.write("<tr><td/>")
|
fp.write("<tr class='headers'><td> </td>")
|
||||||
for job_name in job_names:
|
for job_name in job_names:
|
||||||
fp.write("<td><b>%s</b></td>" % job_name.replace("gate-tripleo-ironic-", ""))
|
fp.write("<td class='headers'><b>%s</b></td>" % job_name.replace("gate-tripleo-ironic-", ""))
|
||||||
fp.write("</tr>")
|
fp.write("</tr>")
|
||||||
count = 0
|
count = 0
|
||||||
for job in session.query(Job).order_by(desc(Job.dt)):
|
for job in session.query(Job).order_by(desc(Job.dt)):
|
||||||
|
@ -154,7 +153,10 @@ def gen_html(html_file, stats_hours):
|
||||||
|
|
||||||
job_columns += '</font><br/>'
|
job_columns += '</font><br/>'
|
||||||
job_columns += "</td>"
|
job_columns += "</td>"
|
||||||
fp.write("<tr><td>")
|
if (count % 2) == 1:
|
||||||
|
fp.write("<tr class='tr0'><td>")
|
||||||
|
else:
|
||||||
|
fp.write("<tr class='tr1'><td>")
|
||||||
project = ""
|
project = ""
|
||||||
if job.zuul_project:
|
if job.zuul_project:
|
||||||
project = job.zuul_project.split("/")[-1]
|
project = job.zuul_project.split("/")[-1]
|
||||||
|
@ -162,7 +164,13 @@ def gen_html(html_file, stats_hours):
|
||||||
% (this_gerrit_ref.replace(",", "/"), this_gerrit_ref, project))
|
% (this_gerrit_ref.replace(",", "/"), this_gerrit_ref, project))
|
||||||
fp.write(job_columns)
|
fp.write(job_columns)
|
||||||
fp.write("</tr>")
|
fp.write("</tr>")
|
||||||
fp.write("<table></body></html>")
|
fp.write("<table>")
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
with open(html_file, "w") as f:
|
||||||
|
f.write('<html><head/><body>')
|
||||||
|
f.write(open(table_file).read())
|
||||||
|
f.write("<table></body></html>")
|
||||||
|
|
||||||
def parse_logs(logurl):
|
def parse_logs(logurl):
|
||||||
if not os.path.isdir("./log"):
|
if not os.path.isdir("./log"):
|
||||||
|
@ -193,7 +201,7 @@ def main(args=sys.argv[1:]):
|
||||||
|
|
||||||
if opts.f:
|
if opts.f:
|
||||||
get_data(opts.n)
|
get_data(opts.n)
|
||||||
gen_html(opts.o, 24)
|
gen_html(opts.o, "%s-table" % opts.o, 24)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
exit(main())
|
exit(main())
|
||||||
|
|
Loading…
Reference in New Issue