update-test-platforms.py : handle non-voting jobs

Add a non-voting platform dictionary so we can easily unblock the gate
via regenerating the automated jobs if one platform is having
temporary issues.  This adds "-nv" to the job name to make it clear
what is happening, and sets the job to "voting: false".

opensuse-15 is in this list, as a follow-on from the manual
(gate-unblocking) update I22d4cc02abaecb23d85aec3d415b43501ab1e0d2

Also, if a non-autogenerated job defined itself as non-voting, it
should not be put in the gate queue.  Handle this too.

Note that regenerating at this point is a no-op as the changes are
manually introduced in the prior change
I22d4cc02abaecb23d85aec3d415b43501ab1e0d2.

Change-Id: If41da9089a961dc27cda954924c17104e622dacc
This commit is contained in:
Ian Wienand 2019-11-25 11:07:42 +11:00 committed by Andreas Jaeger
parent cfdf251140
commit 4341500403

View File

@ -41,6 +41,11 @@ PLATFORMS = [
'ubuntu-xenial',
]
NON_VOTING = [
# Sun Nov 24 22:41:16 UTC 2019 : unresolved issues with the mirror
'opensuse-15'
]
def get_nodeset(platform, multinode):
d = CommentedMap()
@ -65,7 +70,9 @@ def handle_file(fn):
data = yaml.load(open(fn))
outdata = []
outprojects = []
joblist = []
joblist_check = []
joblist_gate = []
has_non_voting = False
for obj in data:
if 'job' in obj:
job = obj['job']
@ -82,8 +89,13 @@ def handle_file(fn):
multinode = False
if all_platforms:
for platform in PLATFORMS:
voting = False if platform in NON_VOTING else True
ojob = CommentedMap()
ojob['name'] = job['name'] + '-' + platform
if not voting:
ojob['name'] += '-nv'
ojob['voting'] = False
has_non_voting = True
desc = job['description'].split('\n')[0]
ojob['description'] = desc + ' on ' \
+ platform
@ -91,9 +103,16 @@ def handle_file(fn):
ojob['tags'] = 'auto-generated'
ojob['nodeset'] = get_nodeset(platform, multinode)
outdata.append({'job': ojob})
joblist.append(ojob['name'])
joblist_check.append(ojob['name'])
if voting:
joblist_gate.append(ojob['name'])
else:
joblist.append(job['name'])
joblist_check.append(job['name'])
# don't append non-voting jobs to gate
if job.get('voting', True):
joblist_gate.append(job['name'])
else:
has_non_voting = True
elif 'project' in obj:
outprojects.append(obj)
else:
@ -101,8 +120,11 @@ def handle_file(fn):
# We control the last project stanza
outdata.extend(outprojects)
project = outprojects[-1]['project']
project['check']['jobs'] = joblist
project['gate']['jobs'] = joblist
project['check']['jobs'] = joblist_check
# Use the same dictionary if there are no non-voting jobs
# (i.e. check is the same as gate); this gives nicer YAML output
# using dictionary anchors
project['gate']['jobs'] = joblist_gate if has_non_voting else joblist_check
with open(fn, 'w') as f:
yaml.dump(outdata, stream=f)