Merge duplicate jobs with different children
Currently this configuration:
post:
- searchlight-tarball
- searchlight-tarball:
- searchlight-pypi-both-upload
Produces this error:
File "/home/jenkins/workspace/gate-project-config-layout/.test/zuul/zuul/scheduler.py", line 448, in add_jobs
job_tree.addJob(layout.getJob(job))
AttributeError: 'NoneType' object has no attribute 'addJob'
In general, duplicate jobs are silently merged, so to correct the
discrepancy, merge children of job trees into existing jobs. With
this change, the resulting configuration will be:
openstack/searchlight
<Job searchlight-tarball>
<Job searchlight-pypi-both-upload>
Change-Id: Ie731f89f12471c8268e6c2d92eaddcae9d8e125f
diff --git a/zuul/model.py b/zuul/model.py
index 6648774..2fa2032 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -545,6 +545,9 @@
t = JobTree(job)
self.job_trees.append(t)
return t
+ for tree in self.job_trees:
+ if tree.job == job:
+ return tree
def getJobs(self):
jobs = []
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 7ea4467..0ee39a0 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -483,10 +483,6 @@
config_project.update(
{pipeline.name: expanded[pipeline.name] +
config_project.get(pipeline.name, [])})
- # TODO: future enhancement -- handle the case where
- # duplicate jobs have different children and you want all
- # of the children to run after a single run of the
- # parent).
layout.projects[config_project['name']] = project
mode = config_project.get('merge-mode', 'merge-resolve')