From 40d4105a5f018eac7b5d56cdd735317e5e76a372 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 25 Nov 2019 11:07:42 +1100 Subject: [PATCH] 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 --- tools/update-test-platforms.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tools/update-test-platforms.py b/tools/update-test-platforms.py index 846685567..c87cb1ea9 100755 --- a/tools/update-test-platforms.py +++ b/tools/update-test-platforms.py @@ -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)