Skip to content

Commit 29ee776

Browse files
authored
Merge pull request #89178 from mramendi/RHDEVDOCS-6347
RHDEVDOCS 6347 PAC: on-path-changed, on-path-changed-ignore annotations
2 parents 09ddf7c + e023d99 commit 29ee776

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

modules/op-matching-pipeline-run-using-pipelines-as-code.adoc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,61 @@ annotations:
4949
* Globs with pattern matching such as `"refs/heads/\*"`
5050
* Tags such as `"refs/tags/1.\*"`
5151

52+
53+
[id="path-matching-pipeline-run-using-pipelines-as-code_{context}"]
54+
== Matching changes in paths to a pipeline run
55+
56+
You can match a pipeline run to changes in a set of paths. {pac} starts the pipeline run when a pull request includes changes in any of the paths that you list.
57+
58+
The `pass:[*]` wildcard denotes any file in the directory. The `pass:[**]` wildcard denotes any file in the directory or any subdirectories on any level under the directory.
59+
60+
You can use the following example to match the `pipeline-pkg-or-cli` pipeline run when a pull request changes any files in the `pkg` directory, the `cli` directory, or any subdirectories under the `cli` directory.
61+
62+
[source,yaml]
63+
----
64+
apiVersion: tekton.dev/v1
65+
kind: PipelineRun
66+
metadata:
67+
name: pipeline-pkg-or-cli
68+
annotations:
69+
pipelinesascode.tekton.dev/on-path-changed: "["pkg/*", "cli/**"]"
70+
# ...
71+
----
72+
73+
[id="exclude-path-matching-pipeline-run-using-pipelines-as-code_{context}"]
74+
== Excluding changes in paths from matching a pipeline run
75+
76+
You can configure a pipeline run to exclude matching if a pull request makes changes only to files in a specified set of paths. If the pipeline run matches an event but the pull request includes changes only to files in the paths that you list, {pac} does not start the pipeline run.
77+
78+
You can use the following example to match the `pipeline-docs-not-generated` pipeline run when a pull request changes any files under the `docs` directory or its subdirectories, except when the changes apply only to the `docs/generated` directory or its subdirectories.
79+
80+
[source,yaml]
81+
----
82+
apiVersion: tekton.dev/v1
83+
kind: PipelineRun
84+
metadata:
85+
name: pipeline-docs-not-generated
86+
annotations:
87+
pipelinesascode.tekton.dev/on-path-changed: "["docs/**"]"
88+
pipelinesascode.tekton.dev/on-path-changed-ignore: "["docs/generated/**"]"
89+
# ...
90+
----
91+
92+
You can use the following example to match the `pipeline-main-not-docs` pipeline run when a pull request targets the `main` branch, except when the changes apply only to the `docs` directory or its subdirectories.
93+
94+
[source,yaml]
95+
----
96+
apiVersion: tekton.dev/v1
97+
kind: PipelineRun
98+
metadata:
99+
name: pipeline-main-not-docs
100+
annotations:
101+
pipelinesascode.tekton.dev/on-target-branch: "[main]"
102+
pipelinesascode.tekton.dev/on-event: "[pull_request]"
103+
pipelinesascode.tekton.dev/on-path-changed-ignore: "["docs/**"]"
104+
# ...
105+
----
106+
52107
[id="label-matching-pipeline-run-using-pipelines-as-code_{context}"]
53108
== Matching a pull request label to a pipeline run
54109

0 commit comments

Comments
 (0)