Add a new dashboard
As recently we started seeing issues in gate jobs for neutron this patch add a dashboard to track patches related to gate failure Change-Id: Id88ee651e40e521f092bf1411fbdbe2d646ea978
This commit is contained in:
parent
745653e3dd
commit
b9c63262a3
|
@ -0,0 +1,94 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
"""
|
||||||
|
Creating url for gerrit dashboard for patches related to gate failure
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from launchpadlib.launchpad import Launchpad
|
||||||
|
|
||||||
|
cachedir = "~/.launchpadlib/cache/"
|
||||||
|
launchpad = Launchpad.login_anonymously('just testing', 'production',
|
||||||
|
cachedir, version="devel")
|
||||||
|
neutron = launchpad.projects['neutron']
|
||||||
|
url = 'https://github.com/openstack/gerrit-dash-creator'
|
||||||
|
dest = '/opt/stack/'
|
||||||
|
|
||||||
|
|
||||||
|
def write_section(filen, section_name, query):
|
||||||
|
print(section_name)
|
||||||
|
if query:
|
||||||
|
filen.write("[section \"")
|
||||||
|
filen.write(section_name)
|
||||||
|
filen.write("\"]\n")
|
||||||
|
filen.write("query = ")
|
||||||
|
filen.write(query)
|
||||||
|
print(query)
|
||||||
|
else:
|
||||||
|
print("No result found\n")
|
||||||
|
|
||||||
|
|
||||||
|
def _search_task(project, **kwargs):
|
||||||
|
bugs = project.searchTasks(**kwargs)
|
||||||
|
if not bugs:
|
||||||
|
return
|
||||||
|
gerrit_query1 = "("
|
||||||
|
for b in bugs:
|
||||||
|
gerrit_query1 += ("topic:bug/%d OR " % b.bug.id)
|
||||||
|
gerrit_query1 = gerrit_query1[:-4]
|
||||||
|
gerrit_query1 += ")\n\n"
|
||||||
|
return gerrit_query1
|
||||||
|
|
||||||
|
|
||||||
|
def get_gate_failure_query(project, **kwargs):
|
||||||
|
cbg = _search_task(project, **kwargs)
|
||||||
|
return cbg
|
||||||
|
|
||||||
|
|
||||||
|
def write_queries_for_project(file_name, project):
|
||||||
|
critical_bugs = {'tags': ['gate-failure'], 'importance': ["Critical"],
|
||||||
|
'status': ["In Progress"]}
|
||||||
|
High_bugs = {'tags': ['gate-failure'], 'importance': ["High"]}
|
||||||
|
|
||||||
|
ml_bugs = {'tags': ['gate-failure'], 'importance': ["Medium", 'Low']}
|
||||||
|
|
||||||
|
cb = get_gate_failure_query(project, **critical_bugs)
|
||||||
|
section_name = "Critical Gate failures %s" % project.name
|
||||||
|
write_section(file_name, section_name, cb)
|
||||||
|
|
||||||
|
hg = get_gate_failure_query(project, **High_bugs)
|
||||||
|
section_name = "High priority Gate failures %s" % project.name
|
||||||
|
write_section(file_name, section_name, hg)
|
||||||
|
|
||||||
|
rest_b = get_gate_failure_query(project, **ml_bugs)
|
||||||
|
section_name = "All other Gate failures %s" % project.name
|
||||||
|
write_section(file_name, section_name, rest_b)
|
||||||
|
|
||||||
|
|
||||||
|
def write_dash_file(file_name):
|
||||||
|
if not os.path.isfile(file_name):
|
||||||
|
with open(file_name, 'w') as f:
|
||||||
|
title = "[dashboard]\ntitle = Neutron Review Gate Failures\n"
|
||||||
|
f.write(title)
|
||||||
|
f.write("description = Review Inbox\n")
|
||||||
|
f.write("foreach = (project:openstack/neutron OR "
|
||||||
|
"project:openstack/python-neutronclient OR "
|
||||||
|
"project:openstack/neutron-lib) status:open NOT owner:self"
|
||||||
|
" NOT label:Code-Review>=-2,self branch:master\n")
|
||||||
|
f.write("\n")
|
||||||
|
write_queries_for_project(f, neutron)
|
||||||
|
else:
|
||||||
|
raise "Dash File already exists"
|
|
@ -32,6 +32,11 @@
|
||||||
<a href=$neutron_dash>
|
<a href=$neutron_dash>
|
||||||
Neutron
|
Neutron
|
||||||
</a>
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href=$neutron_gate_dash>
|
||||||
|
NeutronGate
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
@ -4,6 +4,7 @@ import html_helper
|
||||||
import subprocess
|
import subprocess
|
||||||
from Cheetah.Template import Template
|
from Cheetah.Template import Template
|
||||||
from distutils.dir_util import copy_tree
|
from distutils.dir_util import copy_tree
|
||||||
|
from reviewday import create_gate_fail_dash as gate_dash
|
||||||
|
|
||||||
|
|
||||||
def prep_out_dir(out_dir):
|
def prep_out_dir(out_dir):
|
||||||
|
@ -64,6 +65,17 @@ def create_projects_dashboard(out_dir):
|
||||||
return {'neutron_dash': neutron_dash}
|
return {'neutron_dash': neutron_dash}
|
||||||
|
|
||||||
|
|
||||||
|
def create_gate_failure_dash(out_dir):
|
||||||
|
dashboard_file = '%s/gate.dash' % out_dir
|
||||||
|
gate_dash.write_dash_file(dashboard_file)
|
||||||
|
p = subprocess.Popen(['gerrit-dash-creator',
|
||||||
|
dashboard_file],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
|
neutron_gate_dash, err = p.communicate()
|
||||||
|
return {'neutron_gate_dash': neutron_gate_dash}
|
||||||
|
|
||||||
|
|
||||||
def create_report(out_dir, name_space={}):
|
def create_report(out_dir, name_space={}):
|
||||||
# create html partial with just the unstyled data
|
# create html partial with just the unstyled data
|
||||||
data_table_text = _create_data_html(out_dir, name_space)
|
data_table_text = _create_data_html(out_dir, name_space)
|
||||||
|
@ -71,6 +83,7 @@ def create_report(out_dir, name_space={}):
|
||||||
# create the full report
|
# create the full report
|
||||||
report_name_space = {'data': data_table_text, 'helper': html_helper}
|
report_name_space = {'data': data_table_text, 'helper': html_helper}
|
||||||
report_name_space.update(create_projects_dashboard(out_dir))
|
report_name_space.update(create_projects_dashboard(out_dir))
|
||||||
|
report_name_space.update(create_gate_failure_dash(out_dir))
|
||||||
filename = os.path.join(os.path.dirname(__file__), 'report.html')
|
filename = os.path.join(os.path.dirname(__file__), 'report.html')
|
||||||
report_text = open(filename).read()
|
report_text = open(filename).read()
|
||||||
t = Template(report_text, searchList=[report_name_space])
|
t = Template(report_text, searchList=[report_name_space])
|
||||||
|
|
Loading…
Reference in New Issue