build-fail-reminder: Several enhancements
- Load the fails from rebuildpac data, which is more reliable than the broken project status route of OBS. - Correctly report multispec failures - Correctly report i586 failures - Include unresolvable packages in the report
This commit is contained in:
parent
e9c42f6950
commit
0f7dfb524b
@ -19,6 +19,9 @@ import email.utils
|
|||||||
FACTORY = 'openSUSE:Factory'
|
FACTORY = 'openSUSE:Factory'
|
||||||
SEVEN_DAYS = 7 * 86400
|
SEVEN_DAYS = 7 * 86400
|
||||||
|
|
||||||
|
apiurl = None
|
||||||
|
project = None
|
||||||
|
|
||||||
|
|
||||||
class RemindedPackage(object):
|
class RemindedPackage(object):
|
||||||
def __init__(self, firstfail, problem, reminded, remindCount):
|
def __init__(self, firstfail, problem, reminded, remindCount):
|
||||||
@ -114,6 +117,18 @@ def check_reminder(pname, first, problem, now, Reminded, RemindedLoaded):
|
|||||||
Reminded[pname] = RemindedPackage(first, problem, reminded, remindCount)
|
Reminded[pname] = RemindedPackage(first, problem, reminded, remindCount)
|
||||||
|
|
||||||
|
|
||||||
|
def extract_package_name(source):
|
||||||
|
_, _, _, rpm = source.split('/')
|
||||||
|
# strip multibuild flavor
|
||||||
|
package = rpm.split(':')[0]
|
||||||
|
# check multi spec origin
|
||||||
|
url = osc.core.makeurl(apiurl, ['source', project, package])
|
||||||
|
root = ET.parse(osc.core.http_GET(url))
|
||||||
|
for li in root.findall('linkinfo'):
|
||||||
|
return li.get('package')
|
||||||
|
return package
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
|
||||||
# do some work here
|
# do some work here
|
||||||
@ -122,27 +137,18 @@ def main(args):
|
|||||||
|
|
||||||
osc.conf.get_config(override_apiurl=args.apiurl)
|
osc.conf.get_config(override_apiurl=args.apiurl)
|
||||||
osc.conf.config['debug'] = args.osc_debug
|
osc.conf.config['debug'] = args.osc_debug
|
||||||
|
global apiurl
|
||||||
apiurl = osc.conf.config['apiurl']
|
apiurl = osc.conf.config['apiurl']
|
||||||
|
|
||||||
sender = args.sender
|
sender = args.sender
|
||||||
|
global project
|
||||||
project = args.project
|
project = args.project
|
||||||
|
|
||||||
logger.debug('loading build fails for %s' % project)
|
logger.debug('loading build fails for %s' % project)
|
||||||
url = osc.core.makeurl(apiurl, ['projects', project, 'status'],
|
|
||||||
{'ignore_pending': True,
|
|
||||||
'limit_to_fails': True,
|
|
||||||
'include_versions': False,
|
|
||||||
'format': 'json'
|
|
||||||
})
|
|
||||||
json_data = osc.core.http_GET(url)
|
|
||||||
faildata = {}
|
|
||||||
faildata = json.load(json_data)
|
|
||||||
json_data.close()
|
|
||||||
|
|
||||||
url = osc.core.makeurl(apiurl, ['source', f'{project}:Staging', 'dashboard', f'rebuildpacs.{project}-standard.yaml'])
|
url = osc.core.makeurl(apiurl, ['source', f'{project}:Staging', 'dashboard', f'rebuildpacs.{project}-standard.yaml'])
|
||||||
try:
|
try:
|
||||||
_data = osc.core.http_GET(url)
|
_data = osc.core.http_GET(url)
|
||||||
rebuilddata = yaml.safe_load(_data)['check']
|
rebuilddata = yaml.safe_load(_data)
|
||||||
_data.close()
|
_data.close()
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
@ -150,6 +156,10 @@ def main(args):
|
|||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
rebuilddata.setdefault('check', {})
|
||||||
|
rebuilddata.setdefault('failed', {})
|
||||||
|
rebuilddata.setdefault('unresolvable', {})
|
||||||
|
|
||||||
reminded_json = args.json
|
reminded_json = args.json
|
||||||
if not reminded_json:
|
if not reminded_json:
|
||||||
reminded_json = '{}.reminded.json'.format(project)
|
reminded_json = '{}.reminded.json'.format(project)
|
||||||
@ -167,14 +177,17 @@ def main(args):
|
|||||||
ProjectComplainList = []
|
ProjectComplainList = []
|
||||||
|
|
||||||
# Go through all the failed packages and update the reminder
|
# Go through all the failed packages and update the reminder
|
||||||
for package in faildata:
|
for source, timestamp in rebuilddata['failed'].items():
|
||||||
check_reminder(package["name"], package["firstfail"], "Fails to build", now, Reminded, RemindedLoaded)
|
date = int(dateutil.parser.parse(timestamp).timestamp())
|
||||||
|
check_reminder(extract_package_name(source), date, "Fails to build", now, Reminded, RemindedLoaded)
|
||||||
|
|
||||||
|
for source, timestamp in rebuilddata['unresolvable'].items():
|
||||||
|
date = int(dateutil.parser.parse(timestamp).timestamp())
|
||||||
|
check_reminder(extract_package_name(source), date, "Unresolvable", now, Reminded, RemindedLoaded)
|
||||||
|
|
||||||
repochecks = dict()
|
repochecks = dict()
|
||||||
for prpa, details in rebuilddata.items():
|
for prpa, details in rebuilddata['check'].items():
|
||||||
_, _, _, rpm = prpa.split('/')
|
package = extract_package_name(prpa)
|
||||||
# strip multibuild flavor
|
|
||||||
package = rpm.split(':')[0]
|
|
||||||
date = int(dateutil.parser.parse(details["rebuild"]).timestamp())
|
date = int(dateutil.parser.parse(details["rebuild"]).timestamp())
|
||||||
repochecks.setdefault(package, {"problems": set(), "rebuild": date})
|
repochecks.setdefault(package, {"problems": set(), "rebuild": date})
|
||||||
for problem in details["problem"]:
|
for problem in details["problem"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user