Files
zuul/doc/source/examples/pipelines/github-reference-pipelines.yaml
James E. Blair a738d00fb9 GitHub: Add "queued" check status
This adds support for the "queued" status in github checks.  This allows
users to configure an "enqueue" reporter to set the "queued" status on
a check for a github PR.  Since the "start" reporter doesn't change the
status of a check until Zuul starts to run jobs, this can be used to
provide near-immediate feedback to users that a change has been enqueued
into a pipeline.  If the change remains outside the active window for
some time, the "queued" status can be useful to let users know that
future work is pending.

The reference gate pipeline for github is updated to include
an "enqueue" reporter, as well as a reporter for both "dequeue" and
"no-jobs".  These two, along with "success" and "failure", cover all
of the ways a change may exit a pipeline and will therefore finalize
the check with a completed result (so that it is not left in a pending
state in the github web UI).

Some minor changes are made to the reference pipelines for consistent
formatting.

The docs are updated not only to add the new status keyword, but also
to switch to using the "value" tag in the "zuul" sphinx domain.  This
allows us to link to the individual values.

To ensure that we don't report "dequeue" in cases where we have not
reported anything yet, we add an additional flag to the queue item to
storte whether we have reported "enqueue".  This is initialized in
the constructor, so it will be set for currently existing objects
without the need for an explicit upgrade path.

The code that sets the reported_start flag is updated slightly so that
both reported_start and reported_enqueue are used the same way.

Change-Id: I99653a0b31d26724e1728e3e8368015a11f73bff
2025-11-17 13:44:17 -08:00

148 lines
3.8 KiB
YAML

- pipeline:
name: check
description: |
Newly uploaded patchsets enter this pipeline to receive an
initial check status.
manager: independent
trigger:
github:
# Run this pipeline on new/changed pull requests
- event: pull_request
action:
- opened
- changed
- reopened
# Run in response to a pull request comment "recheck"
- event: pull_request
action: comment
comment: (?i)^\s*recheck\s*$
# 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
comment: false
# It is recommended to use the checks API for consistency with
# other common CI tools that integrate with Github. Results
# will appear on the "checks" tab of PR and changes. There is
# generally no need to have Zuul leave comments when using the
# checks API.
#
# The older status API appears inline with the PR and can be
# enabled by uncommenting the "status:" in the various
# sections below. You should choose one or the other
# depending on project preferences.
#
#status: pending
#comment: false
success:
github:
check: success
comment: false
#status: success
failure:
github:
check: failure
comment: false
#status: failure
dequeue:
github:
check: cancelled
comment: false
- pipeline:
name: gate
description: |
Changes that have been approved by core developers are enqueued
in order in this pipeline, and if they pass tests, will be
merged.
manager: dependent
precedence: high
supercedes: check
require:
github:
review:
# Require an approval from user with write access (e.g. core-reviewer)
- permission: write
type: approved
# Require label
label: gate
open: True
current-patchset: True
trigger:
github:
- event: pull_request_review
action: submitted
state: approved
- event: pull_request
action: comment
comment: (?i)^\s*regate\s*$
- event: pull_request_review
action: dismissed
state: changes_requested
- event: pull_request
action: status
status: ".*:success"
- event: check_run
action: rerequested
check: .*/gate:.*
- event: pull_request
action: labeled
label:
- gate
enqueue:
github:
check: queued
comment: false
start:
github:
check: in_progress
comment: false
#status: pending
success:
github:
check: success
comment: false
#status: success
merge: true
failure:
github:
check: failure
#status: failure
comment: false
no-jobs:
github:
check: skipped
comment: false
dequeue:
github:
check: cancelled
comment: false
window-floor: 20
window-increase-factor: 2
- pipeline:
name: post
post-review: true
description: This pipeline runs jobs that operate after each change is merged.
manager: independent
precedence: low
trigger:
github:
- event: push
ref: ^refs/heads/.*$
- pipeline:
name: tag
description: This pipeline runs jobs in response to any tag event.
manager: independent
precedence: high
post-review: True
trigger:
github:
- event: push
ref: ^refs/tags/.*$