Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/227223

Change subject: 'recheck' on CR+2 now triggers gate-and-submit
......................................................................

'recheck' on CR+2 now triggers gate-and-submit

Does not work yet because the other pipelines should filter out the
change.

Require our Zuul version to be bumped and include:
https://review.openstack.org/#/c/102726/26/doc/source/zuul.rst

Will let us have negative condition on the independent pipelines such
as:

  any-approval:
      code-review: '![2]'

Bug: T105474
Change-Id: Ifc3d0478ad2487b996c4c08d0dbb84b47ac3e9ae
---
M tests/test_zuul_layout.py
M zuul/layout.yaml
2 files changed, 33 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/23/227223/1

diff --git a/tests/test_zuul_layout.py b/tests/test_zuul_layout.py
index f45cc72..797d1bf 100644
--- a/tests/test_zuul_layout.py
+++ b/tests/test_zuul_layout.py
@@ -336,6 +336,35 @@
         event.account = {'email': 'untrus...@example.org'}
         self.assertFalse(test_manager.eventMatches(event, change))
 
+    def test_recheck_on_approved_change_triggers_gate(self):
+        gate_manager = self.getPipeline('gate-and-submit').manager
+
+        change = zuul.model.Change('mediawiki/core')
+        change.approvals = [{'type': 'Code-Review',
+                             'description': 'Code Review',
+                             'value': '2',
+                             'by': {'email': 'some...@wikimedia.org'},
+                             }]
+
+        event = zuul.model.TriggerEvent()
+        event.type = 'comment-added'
+        event.comment = 'Patch Set 1:\n\nrecheck'
+
+        self.assertTrue(gate_manager.eventMatches(event, change),
+                        "gate-and-submit pipeline must process 'recheck' "
+                        "on CR+2")
+
+        indep_pipelines = [p for p in self.getPipelines()
+                           if p.manager.__class__.__name__ ==
+                           'IndependentPipelineManager']
+        self.assertGreater(len(indep_pipelines), 0)
+
+        for pipeline in indep_pipelines:
+            # XXX need to bump our Zuul version to supports negative filters
+            self.assertFalse(pipeline.manager.eventMatches(event, change),
+                             "Independent pipeline %s must not process "
+                             "'recheck' on CR+2" % pipeline.name)
+
     def test_pipelines_trustiness(self):
         check_manager = self.getPipeline('check').manager
         test_manager = self.getPipeline('test').manager
diff --git a/zuul/layout.yaml b/zuul/layout.yaml
index cdc2fae..79d5922 100644
--- a/zuul/layout.yaml
+++ b/zuul/layout.yaml
@@ -447,6 +447,10 @@
            - ^(?!l10n-bot@translatewiki\.net).*$
           approval:
             - code-review: 2
+        - event: comment-added
+          comment_filter: (?im)^Patch Set \d+:\n\n\s*recheck\.?\s*$
+          require-approval:
+            - code-review: 2
     start:
       gerrit:
         verified: 0

-- 
To view, visit https://gerrit.wikimedia.org/r/227223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc3d0478ad2487b996c4c08d0dbb84b47ac3e9ae
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to