-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
RHDEVDOCS 5979 starting pipeline runs manually and on chatops, support OWNERS fully #75409
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
= Creating a pipeline run using {pac} | ||
|
||
[role="_abstract"] | ||
To run pipelines using {pac}, you can create pipelines definitions or templates as YAML files in the `.tekton/` directory of the repository. You can reference YAML files in other repositories using remote URLs, but pipeline runs are only triggered by events in the repository containing the `.tekton/` directory. | ||
To run pipelines using {pac}, you can create pipeline run definitions or templates as YAML files in the `.tekton/` directory of the repository. You can reference YAML files in other repositories using remote URLs, but pipeline runs are only triggered by events in the repository containing the `.tekton/` directory. | ||
|
||
The {pac} resolver bundles the pipeline runs with all tasks as a single pipeline run without external dependencies. | ||
|
||
|
@@ -34,22 +34,23 @@ You can specify the parameters of your commit and URL by using dynamic, expandab | |
[discrete] | ||
.Matching an event to a pipeline run | ||
|
||
You can match different Git provider events with each pipeline by using special annotations on the pipeline run. If there are multiple pipeline runs matching an event, {pac} runs them in parallel and posts the results to the Git provider as soon a pipeline run finishes. | ||
You can match different Git provider events with each pipeline run by using special annotations on the pipeline run. If there are multiple pipeline runs matching an event, {pac} runs them in parallel and posts the results to the Git provider as soon a pipeline run finishes. | ||
|
||
[discrete] | ||
.Matching a pull event to a pipeline run | ||
|
||
You can use the following example to match the `pipeline-pr-main` pipeline with a `pull_request` event that targets the `main` branch: | ||
You can use the following example to match the `pipeline-pr-main` pipeline run with a `pull_request` event that targets the `main` branch: | ||
|
||
[source,yaml] | ||
---- | ||
... | ||
metadata: | ||
name: pipeline-pr-main | ||
annotations: | ||
pipelinesascode.tekton.dev/on-target-branch: "[main]" <1> | ||
pipelinesascode.tekton.dev/on-event: "[pull_request]" | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-pr-main | ||
annotations: | ||
pipelinesascode.tekton.dev/on-target-branch: "[main]" <1> | ||
pipelinesascode.tekton.dev/on-event: "[pull_request]" | ||
# ... | ||
---- | ||
<1> You can specify multiple branches by adding comma-separated entries. For example, `"[main, release-nightly]"`. In addition, you can specify the following: | ||
* Full references to branches such as `"refs/heads/main"` | ||
|
@@ -59,23 +60,50 @@ You can use the following example to match the `pipeline-pr-main` pipeline with | |
[discrete] | ||
.Matching a push event to a pipeline run | ||
|
||
You can use the following example to match the `pipeline-push-on-main` pipeline with a `push` event targeting the `refs/heads/main` branch: | ||
You can use the following example to match the `pipeline-push-on-main` pipeline run with a `push` event targeting the `refs/heads/main` branch: | ||
|
||
[source,yaml] | ||
---- | ||
... | ||
metadata: | ||
name: pipeline-push-on-main | ||
annotations: | ||
pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/main]" <1> | ||
pipelinesascode.tekton.dev/on-event: "[push]" | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-push-on-main | ||
annotations: | ||
pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/main]" <1> | ||
pipelinesascode.tekton.dev/on-event: "[push]" | ||
# ... | ||
---- | ||
<1> You can specifiy multiple branches by adding comma-separated entries. For example, `"[main, release-nightly]"`. In addition, you can specify the following: | ||
<1> You can specify multiple branches by adding comma-separated entries. For example, `"[main, release-nightly]"`. In addition, you can specify the following: | ||
* Full references to branches such as `"refs/heads/main"` | ||
* Globs with pattern matching such as `"refs/heads/\*"` | ||
* Tags such as `"refs/tags/1.\*"` | ||
|
||
[discrete] | ||
.Matching a comment event to a pipeline run | ||
|
||
You can use the following example to match the `pipeline-comment` pipeline run with a comment on a pull request, when the text of the comment matches the `^/merge-pr` regular expression: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chmouel we also support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @savitaashture no still waiting this to be merged 🙃 openshift-pipelines/pipelines-as-code#1638 (would not make it for osp1.5 now as there is not enough time to dogfood this) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah i see its still PR |
||
|
||
[source,yaml] | ||
---- | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-comment | ||
annotations: | ||
pipelinesascode.tekton.dev/on-comment: "^/merge-pr" | ||
# ... | ||
---- | ||
|
||
The pipeline run starts only if the comment author meets one of the following requirements: | ||
mramendi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* The author is the owner of the repository. | ||
* The author is a collaborator on the repository. | ||
* The author is a public member on the organization of the repository. | ||
* The comment author is listed in the `approvers` or `reviewers` section of the `OWNERS` file in the root of the repository, as defined in the https://www.kubernetes.dev/docs/guide/owners/[Kubernetes documentation]. {pac} supports the specification for the `OWNERS` and `OWNERS_ALIASES` files. If the `OWNERS` file includes a https://github.com/kubernetes/community/blob/master/contributors/guide/owners.md#filters[filters] section, {pac} matches approvers and reviewers only against the `.*` filter. | ||
|
||
:FeatureName: Matching a comment event to a pipeline run | ||
include::snippets/technology-preview.adoc[] | ||
|
||
[discrete] | ||
.Advanced event matching | ||
|
||
|
@@ -87,7 +115,11 @@ To use CEL-based filtering with {pac}, consider the following examples of annota | |
+ | ||
[source,yaml] | ||
---- | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-advanced-pr | ||
annotations: | ||
pipelinesascode.tekton.dev/on-cel-expression: | | ||
event == "pull_request" && target_branch == "main" && source_branch == "wip" | ||
... | ||
|
@@ -97,31 +129,43 @@ To use CEL-based filtering with {pac}, consider the following examples of annota | |
+ | ||
[source,yaml] | ||
---- | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-advanced-pr-pathchanged | ||
annotations: | ||
pipelinesascode.tekton.dev/on-cel-expression: | | ||
event == "pull_request" && "docs/\*.md".pathChanged() <1> | ||
... | ||
event == "pull_request" && "docs/\*.md".pathChanged() # <1> | ||
# ... | ||
---- | ||
<1> Matches all markdown files in the `docs` directory. | ||
|
||
* To match all pull requests starting with the title `[DOWNSTREAM]`: | ||
+ | ||
[source,yaml] | ||
---- | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-advanced-pr-downstream | ||
annotations: | ||
pipelinesascode.tekton.dev/on-cel-expression: | | ||
event == "pull_request && event_title.startsWith("[DOWNSTREAM]") | ||
... | ||
# ... | ||
---- | ||
|
||
* To run a pipeline on a `pull_request` event, but skip the `experimental` branch: | ||
+ | ||
[source,yaml] | ||
---- | ||
... | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
name: pipeline-advanced-pr-not-experimental | ||
annotations: | ||
pipelinesascode.tekton.dev/on-cel-expression: | | ||
event == "pull_request" && target_branch != experimental" | ||
... | ||
# ... | ||
---- | ||
|
||
For advanced CEL-based filtering while using {pac}, you can use the following fields and suffix functions: | ||
|
@@ -134,7 +178,7 @@ For advanced CEL-based filtering while using {pac}, you can use the following fi | |
|
||
In addition, you can access the full payload as passed by the Git repository provider. Use the `headers` field to access the headers of the payload, for example, `headers['x-github-event']`. Use the `body` field to access the body of the payload, for example, `body.pull_request.state`. | ||
|
||
:FeatureName: using the header and body of the payload for CEL-based filtering with {pac} | ||
:FeatureName: Using the header and body of the payload for CEL-based filtering with {pac} | ||
include::snippets/technology-preview.adoc[] | ||
|
||
In the following example, the pipeline run starts only if all of the following conditions are true: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ | |
[id="restarting-or-canceling-pipeline-run-using-pipelines-as-code_{context}"] | ||
= Restarting or canceling a pipeline run using {pac} | ||
|
||
You can restart or cancel a pipeline run with no events, such as sending a new commit to your branch or raising a pull request. To restart all pipeline runs, use the *Re-run all checks* feature in the GitHub App. | ||
You can restart or cancel a pipeline run with no events, such as sending a new commit to your branch or raising a pull request. To restart all pipeline runs, use the *Re-run all checks* feature in the GitHub App. | ||
|
||
To restart all or specific pipeline runs, use the following comments: | ||
|
||
* The `/test` and `/retest` comment restarts all pipeline runs. | ||
|
||
* The `/test <pipeline_run_name>` and `/retest <pipeline_run_name>` comment restarts a specific pipeline run. | ||
* The `/test <pipeline_run_name>` and `/retest <pipeline_run_name>` comment starts or restarts a specific pipeline run. You can use this command to start any {pac} pipeline run on the repository, whether or not it was triggered by an event for this pipeline run. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that part is TP, |
||
|
||
To cancel all or specific pipeline runs, use the following comments: | ||
|
||
|
@@ -21,6 +21,17 @@ To cancel all or specific pipeline runs, use the following comments: | |
|
||
The results of the comments are visible under the *Checks* tab of the GitHub App. | ||
|
||
The comment starts, restarts, or cancels any pipeline runs only if the comment author meets one of the following requirements: | ||
|
||
* The author is the owner of the repository. | ||
* The author is a collaborator on the repository. | ||
* The author is a public member on the organization of the repository. | ||
* The comment author is listed in the `approvers` or `reviewers` section of the `OWNERS` file in the root of the repository, as defined in the https://www.kubernetes.dev/docs/guide/owners/[Kubernetes documentation]. {pac} supports the specification for the `OWNERS` and `OWNERS_ALIASES` files. If the `OWNERS` file includes a https://github.com/kubernetes/community/blob/master/contributors/guide/owners.md#filters[filters] section, {pac} matches approvers and reviewers only against the `.*` filter. | ||
|
||
:FeatureName: Using a comment to start a pipeline run that does not match an event | ||
include::snippets/technology-preview.adoc[] | ||
|
||
|
||
.Procedure | ||
|
||
* If you target a pull request and you use the GitHub App, go to the *Checks* tab and click *Re-run all checks*. | ||
|
@@ -49,11 +60,11 @@ This feature is supported for the GitHub provider only. | |
|
||
.. Click on the line number where you want to add a comment. | ||
+ | ||
.Example comment that retests a specific pipeline run | ||
.Example comment that starts or restarts a specific pipeline run | ||
[source] | ||
---- | ||
This is a comment inside a commit. | ||
/retest <pipeline_run_name> | ||
/retest example_pipeline_run | ||
---- | ||
+ | ||
[NOTE] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we mark it a s TP ?