summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-07-20 14:05:48 -0700
committerJames E. Blair <jim@acmegating.com>2022-07-25 13:20:53 -0700
commit4a4a33720b1bca9f454e6f29d89c0865548503d7 (patch)
treea1287d399d9d213a353111e58b68766d27c5a375
parent559602910ff57f90e6478e748d17e0e298430c73 (diff)
downloadzuul-4a4a33720b1bca9f454e6f29d89c0865548503d7.tar.gz
Do not deduplicate the noop job
There is no good reason to do so (there are no resources consumed by the job), and it's difficult to disable a behavior for the noop job globally since it has no definition. Let's never have it deduplicate so that we keep things simple for folks who want to avoid deduplication. Change-Id: Ib3841ce5ef020540edef1cfa479d90c65be97112
-rw-r--r--tests/fixtures/layouts/job-dedup-noop.yaml55
-rw-r--r--tests/unit/test_circular_dependencies.py36
-rw-r--r--zuul/model.py1
3 files changed, 92 insertions, 0 deletions
diff --git a/tests/fixtures/layouts/job-dedup-noop.yaml b/tests/fixtures/layouts/job-dedup-noop.yaml
new file mode 100644
index 000000000..9383fd8b6
--- /dev/null
+++ b/tests/fixtures/layouts/job-dedup-noop.yaml
@@ -0,0 +1,55 @@
+- queue:
+ name: integrated
+ allow-circular-dependencies: true
+
+- pipeline:
+ name: gate
+ manager: dependent
+ success-message: Build succeeded (gate).
+ require:
+ gerrit:
+ approval:
+ - Approved: 1
+ trigger:
+ gerrit:
+ - event: comment-added
+ approval:
+ - Approved: 1
+ success:
+ gerrit:
+ Verified: 2
+ submit: true
+ failure:
+ gerrit:
+ Verified: -2
+ start:
+ gerrit:
+ Verified: 0
+ precedence: high
+
+- job:
+ name: base
+ parent: null
+ pre-run: playbooks/pre.yaml
+ run: playbooks/run.yaml
+ nodeset:
+ nodes:
+ - label: debian
+ name: controller
+
+- job:
+ name: common-job
+ required-projects:
+ - org/project1
+
+- job:
+ name: project1-job
+
+- project:
+ name: org/project1
+ queue: integrated
+ gate:
+ jobs:
+ - noop
+ - common-job
+ - project1-job
diff --git a/tests/unit/test_circular_dependencies.py b/tests/unit/test_circular_dependencies.py
index ac5ad13f5..d70293f17 100644
--- a/tests/unit/test_circular_dependencies.py
+++ b/tests/unit/test_circular_dependencies.py
@@ -1703,6 +1703,42 @@ class TestGerritCircularDependencies(ZuulTestCase):
], ordered=False)
self.assertEqual(len(self.fake_nodepool.history), 3)
+ @simple_layout('layouts/job-dedup-noop.yaml')
+ def test_job_deduplication_noop(self):
+ # Test that we don't deduplicate noop (there's no good reason
+ # to do so)
+ A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
+ B = self.fake_gerrit.addFakeChange('org/project1', 'master', 'B')
+
+ # A <-> B
+ A.data["commitMessage"] = "{}\n\nDepends-On: {}\n".format(
+ A.subject, B.data["url"]
+ )
+ B.data["commitMessage"] = "{}\n\nDepends-On: {}\n".format(
+ B.subject, A.data["url"]
+ )
+
+ A.addApproval('Code-Review', 2)
+ B.addApproval('Code-Review', 2)
+
+ self.fake_gerrit.addEvent(A.addApproval('Approved', 1))
+ self.fake_gerrit.addEvent(B.addApproval('Approved', 1))
+
+ self.waitUntilSettled()
+
+ self.assertEqual(A.data['status'], 'MERGED')
+ self.assertEqual(B.data['status'], 'MERGED')
+ self.assertHistory([
+ dict(name="project1-job", result="SUCCESS", changes="2,1 1,1"),
+ dict(name="common-job", result="SUCCESS", changes="2,1 1,1"),
+ ], ordered=False)
+ # It's tricky to get info about a noop build, but the jobs in
+ # the report have the build UUID, so we make sure it's
+ # different.
+ a_noop = [l for l in A.messages[-1].split('\n') if 'noop' in l][0]
+ b_noop = [l for l in B.messages[-1].split('\n') if 'noop' in l][0]
+ self.assertNotEqual(a_noop, b_noop)
+
@simple_layout('layouts/job-dedup-retry.yaml')
def test_job_deduplication_retry(self):
A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
diff --git a/zuul/model.py b/zuul/model.py
index aa814ce6c..37073c596 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -7066,6 +7066,7 @@ class Layout(object):
noop = Job('noop')
noop.description = 'A job that will always succeed, no operation.'
noop.parent = noop.BASE_JOB_MARKER
+ noop.deduplicate = False
noop.run = (PlaybookContext(None, 'noop.yaml', [], []),)
self.jobs = {'noop': [noop]}
self.nodesets = {}