summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/zuul.py
diff options
context:
space:
mode:
authorThanh Ha <zxiiro@gmail.com>2019-08-23 09:14:39 -0400
committerSorin Sbarnea <ssbarnea@redhat.com>2019-09-09 19:23:24 +0100
commit4d90c187a945c04b9949d5ee7738a049dd634897 (patch)
tree106bf6e05ad1f2260823e7cd68651b535b8ac3ef /jenkins_jobs/modules/zuul.py
parentead185134d8aa5d3d0974207356de6c4fdb2e6e8 (diff)
downloadpython-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.gz
python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.xz
python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.zip
Auto-generated output from python-black
Please review the following patch containing the code changes in the repo. This patch is a transition patch and is the auto-generated output of the python-black tool. Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032 Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Diffstat (limited to 'jenkins_jobs/modules/zuul.py')
-rw-r--r--jenkins_jobs/modules/zuul.py218
1 files changed, 134 insertions, 84 deletions
diff --git a/jenkins_jobs/modules/zuul.py b/jenkins_jobs/modules/zuul.py
index c4f4857a..8766895d 100644
--- a/jenkins_jobs/modules/zuul.py
+++ b/jenkins_jobs/modules/zuul.py
@@ -58,80 +58,129 @@ def zuul_post():
ZUUL_PARAMETERS = [
- {'string':
- {'description': 'Zuul provided key to link builds with Gerrit events',
- 'name': 'ZUUL_UUID'}},
- {'string':
- {'description': 'Zuul provided key to link builds with Gerrit'
- ' events (deprecated use ZUUL_UUID instead)',
- 'name': 'UUID'}},
- {'string':
- {'description': 'Zuul pipeline triggering this job',
- 'name': 'ZUUL_PIPELINE'}},
- {'string':
- {'description': 'URL of Zuul\'s git repos accessible to workers',
- 'name': 'ZUUL_URL'}},
- {'string':
- {'description': 'Branch name of triggering project',
- 'name': 'ZUUL_PROJECT'}},
- {'string':
- {'description': 'Branch name of triggering change',
- 'name': 'ZUUL_BRANCH'}},
- {'string':
- {'description': 'List of dependent changes to merge',
- 'name': 'ZUUL_CHANGES'}},
- {'string':
- {'description': 'Reference for the merged commit(s) to use',
- 'name': 'ZUUL_REF'}},
- {'string':
- {'description': 'The commit SHA1 at the head of ZUUL_REF',
- 'name': 'ZUUL_COMMIT'}},
- {'string':
- {'description': 'List of included changes',
- 'name': 'ZUUL_CHANGE_IDS'}},
- {'string':
- {'description': 'ID of triggering change',
- 'name': 'ZUUL_CHANGE'}},
- {'string':
- {'description': 'Patchset of triggering change',
- 'name': 'ZUUL_PATCHSET'}},
- {'string':
- {'description': 'Zuul considered this job voting or not',
- 'name': 'ZUUL_VOTING'}},
+ {
+ "string": {
+ "description": "Zuul provided key to link builds with Gerrit events",
+ "name": "ZUUL_UUID",
+ }
+ },
+ {
+ "string": {
+ "description": "Zuul provided key to link builds with Gerrit"
+ " events (deprecated use ZUUL_UUID instead)",
+ "name": "UUID",
+ }
+ },
+ {
+ "string": {
+ "description": "Zuul pipeline triggering this job",
+ "name": "ZUUL_PIPELINE",
+ }
+ },
+ {
+ "string": {
+ "description": "URL of Zuul's git repos accessible to workers",
+ "name": "ZUUL_URL",
+ }
+ },
+ {
+ "string": {
+ "description": "Branch name of triggering project",
+ "name": "ZUUL_PROJECT",
+ }
+ },
+ {
+ "string": {
+ "description": "Branch name of triggering change",
+ "name": "ZUUL_BRANCH",
+ }
+ },
+ {
+ "string": {
+ "description": "List of dependent changes to merge",
+ "name": "ZUUL_CHANGES",
+ }
+ },
+ {
+ "string": {
+ "description": "Reference for the merged commit(s) to use",
+ "name": "ZUUL_REF",
+ }
+ },
+ {
+ "string": {
+ "description": "The commit SHA1 at the head of ZUUL_REF",
+ "name": "ZUUL_COMMIT",
+ }
+ },
+ {"string": {"description": "List of included changes", "name": "ZUUL_CHANGE_IDS"}},
+ {"string": {"description": "ID of triggering change", "name": "ZUUL_CHANGE"}},
+ {
+ "string": {
+ "description": "Patchset of triggering change",
+ "name": "ZUUL_PATCHSET",
+ }
+ },
+ {
+ "string": {
+ "description": "Zuul considered this job voting or not",
+ "name": "ZUUL_VOTING",
+ }
+ },
]
ZUUL_POST_PARAMETERS = [
- {'string':
- {'description': 'Zuul provided key to link builds with Gerrit events',
- 'name': 'ZUUL_UUID'}},
- {'string':
- {'description': 'Zuul provided key to link builds with Gerrit'
- ' events (deprecated use ZUUL_UUID instead)',
- 'name': 'UUID'}},
- {'string':
- {'description': 'Zuul pipeline triggering this job',
- 'name': 'ZUUL_PIPELINE'}},
- {'string':
- {'description': 'URL of Zuul\'s git repos accessible to workers',
- 'name': 'ZUUL_URL'}},
- {'string':
- {'description': 'Branch name of triggering project',
- 'name': 'ZUUL_PROJECT'}},
- {'string':
- {'description': 'Name of updated reference triggering this job',
- 'name': 'ZUUL_REF'}},
- {'string':
- {'description': 'Name of updated reference triggering this job',
- 'name': 'ZUUL_REFNAME'}},
- {'string':
- {'description': 'Old SHA at this reference',
- 'name': 'ZUUL_OLDREV'}},
- {'string':
- {'description': 'New SHA at this reference',
- 'name': 'ZUUL_NEWREV'}},
- {'string':
- {'description': 'Shortened new SHA at this reference',
- 'name': 'ZUUL_SHORT_NEWREV'}},
+ {
+ "string": {
+ "description": "Zuul provided key to link builds with Gerrit events",
+ "name": "ZUUL_UUID",
+ }
+ },
+ {
+ "string": {
+ "description": "Zuul provided key to link builds with Gerrit"
+ " events (deprecated use ZUUL_UUID instead)",
+ "name": "UUID",
+ }
+ },
+ {
+ "string": {
+ "description": "Zuul pipeline triggering this job",
+ "name": "ZUUL_PIPELINE",
+ }
+ },
+ {
+ "string": {
+ "description": "URL of Zuul's git repos accessible to workers",
+ "name": "ZUUL_URL",
+ }
+ },
+ {
+ "string": {
+ "description": "Branch name of triggering project",
+ "name": "ZUUL_PROJECT",
+ }
+ },
+ {
+ "string": {
+ "description": "Name of updated reference triggering this job",
+ "name": "ZUUL_REF",
+ }
+ },
+ {
+ "string": {
+ "description": "Name of updated reference triggering this job",
+ "name": "ZUUL_REFNAME",
+ }
+ },
+ {"string": {"description": "Old SHA at this reference", "name": "ZUUL_OLDREV"}},
+ {"string": {"description": "New SHA at this reference", "name": "ZUUL_NEWREV"}},
+ {
+ "string": {
+ "description": "Shortened new SHA at this reference",
+ "name": "ZUUL_SHORT_NEWREV",
+ }
+ },
]
@@ -141,23 +190,24 @@ class Zuul(jenkins_jobs.modules.base.Base):
def handle_data(self, job_data):
changed = False
jobs = itertools.chain(
- job_data.get('job', {}).values(),
- job_data.get('job-template', {}).values())
+ job_data.get("job", {}).values(), job_data.get("job-template", {}).values()
+ )
for job in jobs:
- triggers = job.get('triggers')
+ triggers = job.get("triggers")
if not triggers:
continue
- if ('zuul' not in job.get('triggers', []) and
- 'zuul-post' not in job.get('triggers', [])):
+ if "zuul" not in job.get("triggers", []) and "zuul-post" not in job.get(
+ "triggers", []
+ ):
continue
- if 'parameters' not in job:
- job['parameters'] = []
- if 'zuul' in job.get('triggers', []):
- job['parameters'].extend(ZUUL_PARAMETERS)
- job['triggers'].remove('zuul')
- if 'zuul-post' in job.get('triggers', []):
- job['parameters'].extend(ZUUL_POST_PARAMETERS)
- job['triggers'].remove('zuul-post')
+ if "parameters" not in job:
+ job["parameters"] = []
+ if "zuul" in job.get("triggers", []):
+ job["parameters"].extend(ZUUL_PARAMETERS)
+ job["triggers"].remove("zuul")
+ if "zuul-post" in job.get("triggers", []):
+ job["parameters"].extend(ZUUL_POST_PARAMETERS)
+ job["triggers"].remove("zuul-post")
changed = True
return changed