-
Notifications
You must be signed in to change notification settings - Fork 143
feat(status): report skipped status for unmatched PipelineRuns #2918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zakisk
wants to merge
1
commit into
tektoncd:main
Choose a base branch
from
zakisk:SRVKP-13160-skipped-check-run-per-pipelinerun-mode-imple
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -307,4 +307,7 @@ spec: | |
| container_logs: | ||
| enabled: true | ||
| max_lines: 100 | ||
| status_checks: | ||
| enabled: true | ||
| mode: "per_pipelinerun" | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
docs/content/docs/guides/repository-crd/status-checks.md
|
zakisk marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| --- | ||
| title: Status Checks | ||
| weight: 5 | ||
| --- | ||
|
|
||
| {{< tech_preview "Status Checks settings in Repository CR" >}} | ||
|
|
||
| This page explains how to report status checks for PipelineRuns that did not match the incoming event. Use this when you want visibility into which PipelineRuns in your `.tekton/` directory were skipped because their annotations (target branch, event type, CEL expression, or path filter) did not match. | ||
|
|
||
| By default, Pipelines-as-Code only reports status for PipelineRuns that matched | ||
| and ran. PipelineRuns that did not match are silently ignored. Enabling | ||
| `status_checks` makes Pipelines-as-Code report a status for each unmatched | ||
| PipelineRun so you can see the full picture in your Git provider's UI. | ||
|
|
||
| ## Configuration | ||
|
|
||
| Add the `status_checks` block under `spec.settings` in your Repository CR: | ||
|
|
||
| ```yaml | ||
| apiVersion: "pipelinesascode.tekton.dev/v1alpha1" | ||
| kind: Repository | ||
| metadata: | ||
| name: my-repo | ||
| spec: | ||
| url: "https://github.com/owner/repo" | ||
| settings: | ||
| status_checks: | ||
| enabled: true | ||
| mode: "per_pipelinerun" | ||
| ``` | ||
|
|
||
| ### Fields | ||
|
|
||
| | Field | Type | Default | Description | | ||
| | --- | --- | --- | --- | | ||
| | `enabled` | bool | `false` | Enable status check reporting for unmatched PipelineRuns. | | ||
| | `mode` | string | | How to report status checks. See [Modes](#modes). | | ||
| | `unmatched_conclusion` | string | `skipped` | The conclusion to report for unmatched PipelineRuns. Only used when `mode` is `per_pipelinerun`. Accepted values: `skipped`, `success`, `neutral`. | | ||
|
|
||
| ### Modes | ||
|
|
||
| #### `per_pipelinerun` | ||
|
|
||
| Reports a separate status for each PipelineRun that did not match the event. | ||
| This is useful when you have multiple PipelineRuns targeting different events | ||
| (for example, one for `pull_request` and one for `push`) and you want to see | ||
| which ones were skipped on each event. | ||
|
|
||
| ```yaml | ||
| spec: | ||
| settings: | ||
| status_checks: | ||
| enabled: true | ||
| mode: "per_pipelinerun" | ||
| ``` | ||
|
|
||
| ### Customizing the conclusion | ||
|
|
||
| By default, unmatched PipelineRuns are reported with a `skipped` conclusion. | ||
| You can change this to `success` or `neutral` using the `unmatched_conclusion` | ||
| field: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| settings: | ||
| status_checks: | ||
| enabled: true | ||
| mode: "per_pipelinerun" | ||
| unmatched_conclusion: "success" | ||
| ``` | ||
|
|
||
| ## Provider behavior | ||
|
|
||
| The `skipped` conclusion maps to different states depending on your Git provider: | ||
|
|
||
| | Provider | Reported state | Notes | | ||
| | --- | --- | --- | | ||
| | GitHub App | `skipped` | Shown as a skipped check run. | | ||
| | GitHub Webhook | `success` | GitHub commit status API does not support `skipped`. Reported as `success` with a "Skipped" description. | | ||
| | GitLab | `skipped` | Shown as a skipped pipeline in the Pipelines tab. | | ||
| | Bitbucket Cloud | `STOPPED` | Shown as a stopped build status. | | ||
| | Bitbucket Data Center | `UNKNOWN` | Reported with an unknown state. | | ||
| | Gitea / Forgejo | `success` | Gitea does not support `skipped`. Reported as `success` with a "Skipped" description. | | ||
|
|
||
| ## Example | ||
|
|
||
| Consider a repository with two PipelineRuns: | ||
|
|
||
| - `.tekton/build.yaml` -- targets `pull_request` events on the `main` branch | ||
| - `.tekton/deploy.yaml` -- targets `push` events on the `main` branch | ||
|
|
||
| When a pull request is opened, `build.yaml` matches and runs. Without | ||
| `status_checks`, `deploy.yaml` is silently ignored. With it enabled: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| settings: | ||
| status_checks: | ||
| enabled: true | ||
| mode: "per_pipelinerun" | ||
| ``` | ||
|
|
||
| Pipelines-as-Code reports a `skipped` status for `deploy.yaml`, making it | ||
| visible in the pull request's status checks that the PipelineRun exists but did | ||
| not apply to this event. |
|
zakisk marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.