Refactor conf into its own file, and per user reports.

This commit is contained in:
Michael Still 2014-03-06 16:57:54 +11:00
parent 4e2ffb4318
commit dbf763b938
3 changed files with 118 additions and 101 deletions

View File

@ -5,54 +5,7 @@ import json
import sys import sys
import urllib import urllib
import conf
# This list from https://review.openstack.org/#/admin/groups/270,members and
# https://review.openstack.org/#/admin/groups/91,members
CI_SYSTEM = ['Jenkins',
'Arista Testing',
'Big Switch CI',
'Brocade Tempest',
'Cisco OpenStack CI Robot',
'CitrixJenkins',
'Compass CI',
'Designate Jenkins',
'Docker CI',
'Freescale CI',
'Fuel CI',
'Huawei CI',
'Hyper-V CI',
'IBM DB2 Test',
'IBM Neutron Testing',
'IBM PowerKVM Testing',
'IBM PowerVC Test',
'Mellanox External Testing',
'Metaplugin CI Test',
'Midokura CI Bot',
'NEC OpenStack CI',
'NetScaler TestingSystem',
'Neutron Ryu',
'Nuage CI',
'OpenContrail',
'OpenDaylight Jenkins',
'PLUMgrid CI',
'Puppet Ceph Integration',
'Puppet OpenStack CI',
'Radware 3rd Party Testing',
'Red Hat CI',
'SmokeStack',
'Tail-f NCS Jenkins',
'VMware Mine Sweeper',
'Wherenow.org Jenkins CI',
'XenServer CI',
'murano-ci',
'nicirabot',
'novaimagebuilder-jenkins',
'reddwarf',
'savanna-ci',
'turbo-hipster',
'vArmour CI Test',
'vanillabot',
]
def read_remote_lines(url): def read_remote_lines(url):
@ -117,7 +70,7 @@ if __name__ == '__main__':
j['approvals'] = [{'type': 'CRVW', 'value': 0}] j['approvals'] = [{'type': 'CRVW', 'value': 0}]
author = j['author']['name'] author = j['author']['name']
if not author in CI_SYSTEM: if not author in conf.CI_USERS:
skipped_authors.setdefault(author, 0) skipped_authors.setdefault(author, 0)
skipped_authors[author] += 1 skipped_authors[author] += 1
continue continue

93
conf.py Normal file
View File

@ -0,0 +1,93 @@
# Configuration options
# This list from https://review.openstack.org/#/admin/groups/270,members and
# https://review.openstack.org/#/admin/groups/91,members
CI_USERS = [
'Jenkins',
'Arista Testing',
'Big Switch CI',
'Brocade Tempest',
'Cisco OpenStack CI Robot',
'CitrixJenkins',
'Compass CI',
'Designate Jenkins',
'Docker CI',
'Freescale CI',
'Fuel CI',
'Huawei CI',
'Hyper-V CI',
'IBM DB2 Test',
'IBM Neutron Testing',
'IBM PowerKVM Testing',
'IBM PowerVC Test',
'Mellanox External Testing',
'Metaplugin CI Test',
'Midokura CI Bot',
'NEC OpenStack CI',
'NetScaler TestingSystem',
'Neutron Ryu',
'Nuage CI',
'OpenContrail',
'OpenDaylight Jenkins',
'PLUMgrid CI',
'Puppet Ceph Integration',
'Puppet OpenStack CI',
'Radware 3rd Party Testing',
'Red Hat CI',
'SmokeStack',
'Tail-f NCS Jenkins',
'VMware Mine Sweeper',
'Wherenow.org Jenkins CI',
'XenServer CI',
'murano-ci',
'nicirabot',
'novaimagebuilder-jenkins',
'reddwarf',
'savanna-ci',
'turbo-hipster',
'vArmour CI Test',
'vanillabot',
]
CI_SYSTEM = {
'nova': [
'Jenkins',
'Docker CI',
'Hyper-V CI',
'IBM PowerKVM Testing',
'VMware Mine Sweeper',
'XenServer CI',
'turbo-hipster',
],
'neutron': [
'Jenkins',
'Arista Testing',
'Big Switch CI',
'Brocade Tempest',
'Cisco OpenStack CI Robot',
'Huawei CI',
'Hyper-V CI',
'IBM Neutron Testing',
'Mellanox External Testing',
'Midokura CI Bot',
'NEC OpenStack CI',
'NetScaler TestingSystem',
'Neutron Ryu',
'Nuage CI',
'OpenContrail',
'OpenDaylight Jenkins',
'PLUMgrid CI',
'Tail-f NCS Jenkins',
'VMware Mine Sweeper',
'nicirabot',
]
}
SENTIMENTS = [
'Positive',
'Negative',
'Positive comment',
'Negative comment',
'Negative, buried in comment',
'Unknown'
]

View File

@ -5,50 +5,7 @@ import json
import sys import sys
import time import time
import conf
CI_SYSTEM = {
'nova': [
'Jenkins',
'Docker CI',
'Hyper-V CI',
'IBM PowerKVM Testing',
'VMware Mine Sweeper',
'XenServer CI',
'turbo-hipster',
],
'neutron': [
'Jenkins',
'Arista Testing',
'Big Switch CI',
'Brocade Tempest',
'Cisco OpenStack CI Robot',
'Huawei CI',
'Hyper-V CI',
'IBM Neutron Testing',
'Mellanox External Testing',
'Midokura CI Bot',
'NEC OpenStack CI',
'NetScaler TestingSystem',
'Neutron Ryu',
'Nuage CI',
'OpenContrail',
'OpenDaylight Jenkins',
'PLUMgrid CI',
'Tail-f NCS Jenkins',
'VMware Mine Sweeper',
'nicirabot',
]
}
SENTIMENTS = [
'Positive',
'Negative',
'Positive comment',
'Negative comment',
'Negative, buried in comment',
'Unknown'
]
def patch_list_as_html(l): def patch_list_as_html(l):
out = [] out = []
@ -59,10 +16,17 @@ def patch_list_as_html(l):
return ', '.join(out) return ', '.join(out)
def report(project, prefix): def report(project_filter, user_filter, prefix):
with open('patchsets.json') as f: with open('patchsets.json') as f:
patchsets = json.loads(f.read()) patchsets = json.loads(f.read())
if not user_filter:
user_filter = conf.CI_SYSTEM[prefix]
elif user_filter and not 'Jenkins' in user_filter:
user_filter_new = ['Jenkins']
user_filter_new.extend(user_filter)
user_filter = user_filter_new
# This is more complicated than it looks because we need to handle # This is more complicated than it looks because we need to handle
# patchsets which are uploaded so rapidly that older patchsets aren't # patchsets which are uploaded so rapidly that older patchsets aren't
# finished testing. # finished testing.
@ -78,8 +42,9 @@ def report(project, prefix):
if patchsets[number].get('__exemption__'): if patchsets[number].get('__exemption__'):
continue continue
if patchsets[number].get('__project__') != project: if project_filter != '*':
continue if patchsets[number].get('__project__') != project_filter:
continue
patches = sorted(patchsets[number].keys()) patches = sorted(patchsets[number].keys())
valid_patches = [] valid_patches = []
@ -109,6 +74,9 @@ def report(project, prefix):
if author == '__created__': if author == '__created__':
continue continue
if author not in user_filter:
continue
total_votes.setdefault(author, 0) total_votes.setdefault(author, 0)
total_votes[author] += 1 total_votes[author] += 1
@ -128,7 +96,7 @@ def report(project, prefix):
sentiments[author][sentiment].append( sentiments[author][sentiment].append(
'%s,%s' % (number, patch)) '%s,%s' % (number, patch))
for author in CI_SYSTEM[prefix]: for author in user_filter:
if not author in patchsets[number][patch]: if not author in patchsets[number][patch]:
missed_votes.setdefault(author, []) missed_votes.setdefault(author, [])
missed_votes[author].append('%s,%s' % (number, patch)) missed_votes[author].append('%s,%s' % (number, patch))
@ -136,7 +104,7 @@ def report(project, prefix):
with open('%s-cireport.html' % prefix, 'w') as f: with open('%s-cireport.html' % prefix, 'w') as f:
f.write('<b>Valid patches in report period: %d</b><ul>' f.write('<b>Valid patches in report period: %d</b><ul>'
% total_patches) % total_patches)
for author in CI_SYSTEM[prefix]: for author in user_filter:
if not author in total_votes: if not author in total_votes:
f.write('<li><font color=blue>No votes recorded for ' f.write('<li><font color=blue>No votes recorded for '
'<b>%s</b></font></li>' '<b>%s</b></font></li>'
@ -170,7 +138,7 @@ def report(project, prefix):
% (len(missed_votes.get(author, [])), % (len(missed_votes.get(author, [])),
patch_list_as_html( patch_list_as_html(
missed_votes.get(author, [])))) missed_votes.get(author, []))))
for sentiment in SENTIMENTS: for sentiment in conf.SENTIMENTS:
count = len(sentiments.get(author, {}).get( count = len(sentiments.get(author, {}).get(
sentiment, [])) sentiment, []))
if count > 0: if count > 0:
@ -185,5 +153,8 @@ def report(project, prefix):
if __name__ == '__main__': if __name__ == '__main__':
report ('openstack/nova', 'nova') report('openstack/nova', None, 'nova')
report ('openstack/neutron', 'neutron') report('openstack/neutron', None, 'neutron')
for user in conf.CI_USERS:
report('*', [user], user.replace(' ', '_'))