Add skipped / neutral statuses to the github driver
Github also supported these 2 settings in check runs. In the case of a PR being dequeued it maybe be nicer in the UI to use 'skipped' as Github will render this as 'grey'. https://docs.github.com/en/rest/reference/checks#update-a-check-run Change-Id: I9313a4f96655054fd2ba1b4f899c1959283f159e Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
0283c4b39f
commit
94ee11ec18
|
@ -385,10 +385,12 @@ itself. Status name, description, and context is taken from the pipeline.
|
|||
Report status via the Github `checks API
|
||||
<https://docs.github.com/v3/checks/>`__. Set to one of
|
||||
|
||||
* ``in_progress``
|
||||
* ``success``
|
||||
* ``cancelled``
|
||||
* ``failure``
|
||||
* ``cancelled``
|
||||
* ``in_progress``
|
||||
* ``neutral``
|
||||
* ``skipped``
|
||||
* ``success``
|
||||
|
||||
This is usually mutually exclusive with a value set in
|
||||
:attr:`pipeline.<reporter>.<github source>.status`, since this
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The Github driver can now use 'skipped' and 'neutral' status for
|
||||
:attr:`pipeline.<reporter>.<github source>.check` attribute on the
|
||||
Github reporter.
|
|
@ -100,6 +100,28 @@
|
|||
github:
|
||||
check: cancelled
|
||||
|
||||
- pipeline:
|
||||
name: checks-api-reporting-skipped
|
||||
description: Reporting via Githubs Checks API
|
||||
manager: independent
|
||||
trigger:
|
||||
github:
|
||||
- event: push
|
||||
- event: pull_request
|
||||
action: opened
|
||||
start:
|
||||
github:
|
||||
check: in_progress
|
||||
success:
|
||||
github:
|
||||
check: success
|
||||
failure:
|
||||
github:
|
||||
check: failure
|
||||
dequeue:
|
||||
github:
|
||||
check: skipped
|
||||
|
||||
- pipeline:
|
||||
name: gate
|
||||
manager: dependent
|
||||
|
@ -150,3 +172,12 @@
|
|||
gate:
|
||||
jobs:
|
||||
- project-test1
|
||||
|
||||
- project:
|
||||
name: org/project4
|
||||
checks-api-reporting-skipped:
|
||||
jobs:
|
||||
- project-test1
|
||||
gate:
|
||||
jobs:
|
||||
- project-test1
|
||||
|
|
|
@ -1875,7 +1875,7 @@ class TestGithubAppDriver(ZuulGithubAppTestCase):
|
|||
@simple_layout("layouts/reporting-github.yaml", driver="github")
|
||||
def test_reporting_checks_api_dequeue(self):
|
||||
"Test that a dequeued change will be reported back to the check run"
|
||||
project = "org/project3"
|
||||
project = "org/project4"
|
||||
github = self.fake_github.getGithubClient(None)
|
||||
|
||||
client = zuul.rpcclient.RPCClient(
|
||||
|
@ -1896,31 +1896,34 @@ class TestGithubAppDriver(ZuulGithubAppTestCase):
|
|||
self.assertEqual(1, len(check_runs))
|
||||
check_run = check_runs[0]
|
||||
|
||||
self.assertEqual("tenant-one/checks-api-reporting", check_run["name"])
|
||||
self.assertEqual(
|
||||
"tenant-one/checks-api-reporting-skipped", check_run["name"])
|
||||
self.assertEqual("in_progress", check_run["status"])
|
||||
self.assertThat(
|
||||
check_run["output"]["summary"],
|
||||
MatchesRegex(r'.*Starting checks-api-reporting jobs.*', re.DOTALL)
|
||||
MatchesRegex(
|
||||
r'.*Starting checks-api-reporting-skipped jobs.*', re.DOTALL)
|
||||
)
|
||||
|
||||
# Use the client to dequeue the pending change
|
||||
client.dequeue(
|
||||
tenant="tenant-one",
|
||||
pipeline="checks-api-reporting",
|
||||
project="org/project3",
|
||||
pipeline="checks-api-reporting-skipped",
|
||||
project="org/project4",
|
||||
change="{},{}".format(A.number, A.head_sha),
|
||||
ref=None,
|
||||
)
|
||||
self.waitUntilSettled()
|
||||
|
||||
# We should now have a cancelled check run for the head sha
|
||||
# We should now have a skipped check run for the head sha
|
||||
check_runs = self.fake_github.getCommitChecks(project, A.head_sha)
|
||||
self.assertEqual(1, len(check_runs))
|
||||
check_run = check_runs[0]
|
||||
|
||||
self.assertEqual("tenant-one/checks-api-reporting", check_run["name"])
|
||||
self.assertEqual(
|
||||
"tenant-one/checks-api-reporting-skipped", check_run["name"])
|
||||
self.assertEqual("completed", check_run["status"])
|
||||
self.assertEqual("cancelled", check_run["conclusion"])
|
||||
self.assertEqual("skipped", check_run["conclusion"])
|
||||
self.assertThat(
|
||||
check_run["output"]["summary"],
|
||||
MatchesRegex(r'.*Build canceled.*', re.DOTALL)
|
||||
|
|
|
@ -218,6 +218,7 @@ class GithubReporter(BaseReporter):
|
|||
# check the state the reporter is going to report.
|
||||
completed = (
|
||||
item.current_build_set.result is not None or status == "cancelled"
|
||||
or status == "skipped" or status == "neutral"
|
||||
)
|
||||
|
||||
log.debug(
|
||||
|
@ -330,6 +331,8 @@ def getSchema():
|
|||
'unlabel': scalar_or_list(str),
|
||||
'review': v.Any('approve', 'request-changes', 'comment'),
|
||||
'review-body': str,
|
||||
'check': v.Any("in_progress", "success", "failure", "cancelled"),
|
||||
'check': v.Any(
|
||||
"in_progress", "success", "failure", "cancelled",
|
||||
"skipped", "neutral"),
|
||||
})
|
||||
return github_reporter
|
||||
|
|
Loading…
Reference in New Issue