You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Support PipelineRun re-triggering on git tag
- Add tag-aware GitOps parsing to handle `/test ... tag:<TAG>`
- Support commit comments on tag commits in provider flow
- Retrigger matching PipelineRun using the tag's commit SHA
- Add/extend unit tests for tag parsing and provider behavior
- Add docs about the feature
- E2E: add TestGithubGitOpsCommentOnTag and tag helper
- Add test data: test/testdata/pipelinerun-on-tag.yaml
- Minor cleanups in test helpers and github_push_test.go
- No API changes; default behavior unchanged
Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
Copy file name to clipboardExpand all lines: docs/content/docs/guide/gitops_commands.md
+98-18Lines changed: 98 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
title: GitOps Commands
3
3
weight: 5.1
4
4
---
5
+
5
6
# GitOps Commands
6
7
7
8
Pipelines-as-Code supports the concept of `GitOps commands`, which allow users to issue special commands in a comment on a Pull Request or a pushed commit to control `Pipelines-as-Code`.
@@ -59,6 +60,7 @@ This means:
59
60
1. When a user comments with commands like `/retest` or `/test` on a branch without specifying a branch name, the test will automatically run on the **default branch** (e.g. main, master) of the repository.
60
61
61
62
Examples:
63
+
62
64
1.`/retest`
63
65
2.`/test`
64
66
3.`/retest <pipelinerun-name>`
@@ -67,6 +69,7 @@ This means:
67
69
2. If the user includes a branch specification such as `/retest branch:test` or `/test branch:test`, the test will be executed on the commit where the comment is located, with the context of the **test** branch.
68
70
69
71
Examples:
72
+
70
73
1.`/retest branch:test`
71
74
2.`/test branch:test`
72
75
3.`/retest <pipelinerun-name> branch:test`
@@ -102,6 +105,81 @@ Please note that this feature is supported for the GitHub provider only.
102
105
103
106
The PipelineRun will be restarted regardless of the annotations if the comment `/test <pipelinerun-name>` or `/retest <pipelinerun-name>` is used. This allows you to have control of PipelineRuns that get only triggered by a comment on the Pull Request.
1. Go to your repository and open the Tags view (or Releases).
180
+
2. Click the tag (for example, `v1.0.0`) to navigate to its commit.
181
+
3. Add a comment on the commit with one of the commands above.
182
+
105
183
## Accessing the Comment Triggering the PipelineRun
106
184
107
185
When you trigger a PipelineRun via a GitOps Command, the template variable `{{
@@ -204,12 +282,14 @@ This means:
204
282
1. If a user specifies commands like `/cancel` without any argument in a comment on a branch, it will automatically target the **main** branch.
205
283
206
284
Examples:
285
+
207
286
1. `/cancel`
208
287
2. `/cancel <pipelinerun-name>`
209
288
210
289
2. If the user issues a command like `/cancel branch:test`, it will target the commit where the comment was made but use the **test** branch.
211
290
212
291
Examples:
292
+
213
293
1. `/cancel branch:test`
214
294
2. `/cancel <pipelinerun-name> branch:test`
215
295
@@ -241,10 +321,10 @@ You can pass those `key=value` pairs anywhere in your comment, and they will be
241
321
242
322
There are different formats that can be accepted, allowing you to pass values with spaces or newlines:
243
323
244
-
* key=value
245
-
* key="a value"
246
-
* key="another \"value\" defined"
247
-
* key="another
324
+
-key=value
325
+
-key="a value"
326
+
-key="another \"value\" defined"
327
+
-key="another
248
328
value with newline"
249
329
250
330
## Event Type Annotation and Dynamic Variables
@@ -253,14 +333,14 @@ The `pipeline.tekton.dev/event-type` annotation indicates the type of GitOps com
253
333
254
334
Here are the possible event types:
255
335
256
-
* `test-all-comment`: The event is a single `/test` that would test every matched PipelineRun.
257
-
* `test-comment`: The event is a `/test <PipelineRun>` comment that would test a specific PipelineRun.
258
-
* `retest-all-comment`: The event is a single `/retest` that would retest every matched PipelineRun.
259
-
* `retest-comment`: The event is a `/retest <PipelineRun>` that would retest a specific PipelineRun.
260
-
* `on-comment`: The event is coming from a custom comment that would trigger a PipelineRun.
261
-
* `cancel-all-comment`: The event is a single `/cancel` that would cancel every matched PipelineRun.
262
-
* `cancel-comment`: The event is a `/cancel <PipelineRun>` that would cancel a specific PipelineRun.
263
-
* `ok-to-test-comment`: The event is a `/ok-to-test` that would allow running the CI for an unauthorized user.
336
+
-`test-all-comment`: The event is a single `/test` that would test every matched PipelineRun.
337
+
-`test-comment`: The event is a `/test <PipelineRun>` comment that would test a specific PipelineRun.
338
+
-`retest-all-comment`: The event is a single `/retest` that would retest every matched PipelineRun.
339
+
-`retest-comment`: The event is a `/retest <PipelineRun>` that would retest a specific PipelineRun.
340
+
-`on-comment`: The event is coming from a custom comment that would trigger a PipelineRun.
341
+
-`cancel-all-comment`: The event is a single `/cancel` that would cancel every matched PipelineRun.
342
+
-`cancel-comment`: The event is a `/cancel <PipelineRun>` that would cancel a specific PipelineRun.
343
+
-`ok-to-test-comment`: The event is a `/ok-to-test` that would allow running the CI for an unauthorized user.
264
344
265
345
If a repository owner comments `/ok-to-test` on a pull request from an external contributor but no PipelineRun **matches** the `pull_request` event (or the repository has no `.tekton` directory), Pipelines-as-Code sets a **neutral** commit status. This indicates that no PipelineRun was matched, allowing other workflows—such as auto-merge—to proceed without being blocked.
266
346
@@ -272,12 +352,12 @@ Note: This neutral check-run status functionality is only supported on GitHub.
272
352
273
353
When using the `{{ event_type }}` [dynamic variable]({{< relref "/docs/guide/authoringprs.md#dynamic-variables" >}}) for the following event types:
274
354
275
-
* `test-all-comment`
276
-
* `test-comment`
277
-
* `retest-all-comment`
278
-
* `retest-comment`
279
-
* `cancel-all-comment`
280
-
* `ok-to-test-comment`
355
+
-`test-all-comment`
356
+
-`test-comment`
357
+
-`retest-all-comment`
358
+
-`retest-comment`
359
+
-`cancel-all-comment`
360
+
-`ok-to-test-comment`
281
361
282
362
The dynamic variable will return `pull_request` as the event type instead of the specific categorized GitOps command type. This is to handle backward compatibility with previous releases for users relying on this dynamic variable.
0 commit comments