Browse Source

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
changes/81/83181/1
James E. Blair 8 years ago
parent
commit
12a92b1866
  1. 4
      doc/source/zuul.rst
  2. 5
      tests/fixtures/layout.yaml
  3. 9
      tests/test_scheduler.py
  4. 7
      zuul/model.py
  5. 9
      zuul/scheduler.py

4
doc/source/zuul.rst

@ -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
~~~~~~~~~~~~

5
tests/fixtures/layout.yaml vendored

@ -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

9
tests/test_scheduler.py

@ -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')

7
zuul/model.py

@ -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 = []

9
zuul/scheduler.py

@ -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')

Loading…
Cancel
Save