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
fix: don't restart successful pipelineruns on /retest /ok-to-test
/retest and /ok-to-test should only restart failed pipelines; the
changes in the PR ensure that we do not match successful pipelineruns
during invocation of these gitops commands. The tests have also been
updated to use /test instead wherever /retest is being used to restart
successful pipelines
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Assisted-by: Claude-4-Sonnet (via Cursor)
Copy file name to clipboardExpand all lines: docs/content/_index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ tracking using a Git workflow.
35
35
36
36
<--->
37
37
38
-
- Pull-request "*GitOps*" actions through comments with `/retest`, `/test <pipeline-name>` and so on.
38
+
- Pull-request "*GitOps*" actions through comments with `/retest` (reruns failed pipelines), `/test <pipeline-name>` (force rerun specific pipeline) and so on.
39
39
40
40
- Automatic Task resolution in Pipelines (local Tasks, Artifact Hub, and remote URLs)
Copy file name to clipboardExpand all lines: docs/content/docs/guide/gitops_commands.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The advantage of using a `GitOps command` is that it provides a journal of all t
11
11
12
12
## GitOps Commands on Pull Requests
13
13
14
-
For example, when you are on a Pull Request, you may want to restart all your PipelineRuns. To do so, you can add a comment on your Pull Request starting with `/retest`, and all PipelineRuns attached to that Pull Request will be restarted.
14
+
For example, when you are on a Pull Request, you may want to restart failed PipelineRuns. To do so, you can add a comment on your Pull Request starting with `/retest`, and all **failed**PipelineRuns attached to that Pull Request will be restarted. If all previous PipelineRuns for the same commit were successful, no new PipelineRuns will be created to avoid unnecessary duplication.
15
15
16
16
Example:
17
17
@@ -22,6 +22,23 @@ failure is not with your PR but seems to be an infrastructure issue.
22
22
/retest
23
23
```
24
24
25
+
The `/retest` command will only create new PipelineRuns if:
26
+
27
+
- Previously **failed** PipelineRuns for the same commit, OR
28
+
- No PipelineRun has been run for the same commit yet
29
+
30
+
If a successful PipelineRun already exists for the same commit, `/retest` will **skip** triggering a new PipelineRun to avoid unnecessary duplication.
31
+
32
+
**To force a rerun regardless of previous status**, use:
33
+
34
+
```text
35
+
/retest <pipelinerun-name>
36
+
```
37
+
38
+
This will always trigger a new PipelineRun, even if previous runs were successful.
39
+
40
+
Similar to `/retest`, the `/ok-to-test` command will only trigger new PipelineRuns if no successful PipelineRun already exists for the same commit. This prevents duplicate runs when repository owners repeatedly test the same commit by `/test` and `/retest` command.
41
+
25
42
If you have multiple `PipelineRun` and you want to target a specific `PipelineRun`, you can use the `/test` command followed by the specific PipelineRun name to restart it. Example:
26
43
27
44
```text
@@ -335,12 +352,12 @@ Here are the possible event types:
335
352
336
353
- `test-all-comment`: The event is a single `/test` that would test every matched PipelineRun.
337
354
- `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.
355
+
- `retest-all-comment`: The event is a single `/retest` that would retest every matched **failed** PipelineRun. If a successful PipelineRun already exists for the same commit, no new PipelineRun will be created.
339
356
- `retest-comment`: The event is a `/retest <PipelineRun>` that would retest a specific PipelineRun.
340
357
- `on-comment`: The event is coming from a custom comment that would trigger a PipelineRun.
341
358
- `cancel-all-comment`: The event is a single `/cancel` that would cancel every matched PipelineRun.
342
359
- `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.
360
+
- `ok-to-test-comment`: The event is a `/ok-to-test` that would allow running the CI for an unauthorized user. If a successful PipelineRun already exists for the same commit, no new PipelineRun will be created.
344
361
345
362
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.
0 commit comments