Browse Source

Remove translation of check run action in github driver

Drivers should pass event data unmodified so trigger documentation can
refer directly to upstream api documentation like GitHub. This is
handled incorrectly for the check_run action 'rerequested' which had
been simplified to 'requested'. Fix this by removing the translation
and add a temporary compatibility layer to prepare future removal.

Change-Id: I2a75c92d1aeacf261b517a328d91ea02f6013762
changes/12/790812/3
Tobias Henkel 1 month ago
parent
commit
21ce3f9ad7
No known key found for this signature in database GPG Key ID: 3750DEC158E5FA2
4 changed files with 21 additions and 3 deletions
  1. +2
    -0
      doc/source/examples/pipelines/github-reference-pipelines.yaml
  2. +8
    -0
      releasenotes/notes/requested-c7f561f338348f9e.yaml
  3. +0
    -3
      zuul/driver/github/githubconnection.py
  4. +11
    -0
      zuul/driver/github/githubtrigger.py

+ 2
- 0
doc/source/examples/pipelines/github-reference-pipelines.yaml View File

@ -19,6 +19,8 @@
# When using the checks API to report results, failed runs
# will have a "re-run" button which emits this event.
- event: check_run
action: rerequested
check: .*/check:.*
start:
github:
check: 'in_progress'


+ 8
- 0
releasenotes/notes/requested-c7f561f338348f9e.yaml View File

@ -0,0 +1,8 @@
---
deprecations:
- |
Zuul now correctly handles the ``rerequested`` action on check run trigger
definitions (:value:`pipeline.trigger.<github source>.event.check_run`)
literally. This has been ``requested`` which doesn't match the GitHub api.
The value ``requested`` is now deprecated and will be removed in a later
release.

+ 0
- 3
zuul/driver/github/githubconnection.py View File

@ -575,9 +575,6 @@ class GithubEventProcessor(object):
event = self._pull_request_to_event(pr_body)
event.type = "check_run"
# Simplify rerequested action to requested
if action == "rerequested":
action = "requested"
event.action = action
check_run_tuple = "%s:%s:%s" % _check_as_tuple(check_run)


+ 11
- 0
zuul/driver/github/githubtrigger.py View File

@ -23,6 +23,17 @@ class GithubTrigger(BaseTrigger):
name = 'github'
log = logging.getLogger("zuul.trigger.GithubTrigger")
def __init__(self, driver, connection, config=None):
# This is a compatibility layer to map the action 'requested' back
# to the original action 'rerequested'.
# TODO: Remove after zuul 5.0
for item in config:
if item.get('action') == 'requested':
item['action'] = 'rerequested'
super().__init__(driver, connection, config=config)
def getEventFilters(self, connection_name, trigger_config):
efilters = []
for trigger in to_list(trigger_config):


Loading…
Cancel
Save