Revert "Allow multiple invocations of the same job"

This reverts commit 3aa3727225.

There are several more places in Zuul where it is assumed that job
names are unique.  Fixing them all would be complicated and perhaps
not worth the benefit.  Go back to requiring that they be unique for
a project.

Change-Id: I5b8aa33d6aed9cb086f44594ce59947c0190cc11
This commit is contained in:
James E. Blair 2014-03-26 11:54:53 -07:00
parent 6e81141f58
commit 12a92b1866
5 changed files with 12 additions and 22 deletions

View File

@ -772,8 +772,8 @@ for the project.
Note that if multiple templates are used for a project and one
template specifies a job that is also specified in another template,
or specified in the project itself, those jobs will be duplicated in
the resulting project configuration.
or specified in the project itself, the configuration defined by
either the last template or the project itself will take priority.
logging.conf
~~~~~~~~~~~~

View File

@ -117,9 +117,6 @@ project-templates:
- name: test-five
check:
- '{name}-{something}-test5'
- name: test-five-also
check:
- '{name}-{something}-test5'
projects:
- name: org/project
@ -215,8 +212,6 @@ projects:
- name: test-three-and-four
- name: test-five
something: foo
- name: test-five-also
something: foo
check:
- project-test6

View File

@ -2061,13 +2061,8 @@ class TestScheduler(testtools.TestCase):
).result, 'SUCCESS')
self.assertEqual(self.getJobFromHistory('layered-project-test4'
).result, 'SUCCESS')
# test5 should run twice because two templates define it
test5_count = 0
for job in self.worker.build_history:
if job.name == 'layered-project-foo-test5':
test5_count += 1
self.assertEqual(job.result, 'SUCCESS')
self.assertEqual(test5_count, 2)
self.assertEqual(self.getJobFromHistory('layered-project-foo-test5'
).result, 'SUCCESS')
self.assertEqual(self.getJobFromHistory('project-test6').result,
'SUCCESS')

View File

@ -596,9 +596,10 @@ class JobTree(object):
self.job_trees = []
def addJob(self, job):
t = JobTree(job)
self.job_trees.append(t)
return t
if job not in [x.job for x in self.job_trees]:
t = JobTree(job)
self.job_trees.append(t)
return t
def getJobs(self):
jobs = []

View File

@ -384,11 +384,10 @@ class Scheduler(threading.Thread):
config_project.update(
{pipeline.name: expanded[pipeline.name] +
config_project.get(pipeline.name, [])})
# TODO: future enhancement -- add an option to the
# template block to indicate that duplicate jobs should be
# merged (especially to handle the case where they have
# children and you want all of the children to run after a
# single run of the parent).
# 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')