review callback: Set labels, render list of failed checks in reporter
This commit is contained in:
parent
18d537e5d4
commit
c487ada514
|
@ -608,20 +608,64 @@ def gerritReviewCB(builderName, build, result, master, arg):
|
|||
if builderName != 'lix/nix-eval':
|
||||
return dict()
|
||||
|
||||
message = "Buildbot finished compiling your patchset\n"
|
||||
message += "on configuration: %s\n" % builderName
|
||||
all_checks = {}
|
||||
for step in build['steps']:
|
||||
if step['name'] != 'build flake':
|
||||
continue
|
||||
|
||||
for url in step['urls']:
|
||||
if url['name'].startswith('success: checks.'):
|
||||
path = url['name'].split(' ')[1]
|
||||
all_checks[path] = (True, url['url'])
|
||||
elif url['name'].startswith('failure: checks.'):
|
||||
path = url['name'].split(' ')[1]
|
||||
all_checks[path] = (False, url['url'])
|
||||
|
||||
collected_oses = {}
|
||||
for check in all_checks:
|
||||
arch = check.split('.')[1]
|
||||
os = arch.split('-')[1]
|
||||
(success, failure) = collected_oses.get(os, (0, 0))
|
||||
if all_checks[check][0]:
|
||||
success += 1
|
||||
else:
|
||||
failure += 1
|
||||
|
||||
collected_oses[os] = (success, failure)
|
||||
labels = {}
|
||||
|
||||
if 'linux' in collected_oses:
|
||||
(success, failure) = collected_oses['linux']
|
||||
if success > 0 and failure == 0:
|
||||
labels['Verified-On-Linux'] = 1
|
||||
elif failure > 0:
|
||||
labels['Verified-On-Linux'] = -1
|
||||
|
||||
if 'darwin' in collected_oses:
|
||||
(success, failure) = collected_oses['darwin']
|
||||
if success > 0 and failure == 0:
|
||||
labels['Verified-On-Darwin'] = 1
|
||||
elif failure > 0:
|
||||
labels['Verified-On-Darwin'] = -1
|
||||
|
||||
message = "Buildbot finished compiling your patchset!\n"
|
||||
message += "The result is: %s\n" % util.Results[result].upper()
|
||||
if result != util.SUCCESS:
|
||||
successful_checks = []
|
||||
failed_checks = []
|
||||
for check in all_checks:
|
||||
if not all_checks[check][0]:
|
||||
failed_checks.append(f" - {check} (see {all_checks[check][1]})")
|
||||
|
||||
if len(failed_checks) > 0:
|
||||
message += "Failed checks:\n" + "\n".join(failed_checks) + "\n"
|
||||
|
||||
|
||||
if arg:
|
||||
message += "\nFor more details visit:\n"
|
||||
message += build['url'] + "\n"
|
||||
|
||||
if result == util.SUCCESS:
|
||||
verified = 1
|
||||
else:
|
||||
verified = -1
|
||||
|
||||
return dict(message=message, labels={'Verified': verified})
|
||||
return dict(message=message, labels=labels)
|
||||
|
||||
def gerritStartCB(builderName, build, arg):
|
||||
message = "Buildbot started compiling your patchset\n"
|
||||
|
|
Loading…
Reference in a new issue