Skip to content

Commit 53877c2

Browse files
waveywaveszakisk
authored andcommitted
docs: /retest /ok-to-test update for running failed PRs only
1 parent d23c330 commit 53877c2

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

docs/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tracking using a Git workflow.
3535

3636
<--->
3737

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.
3939

4040
- Automatic Task resolution in Pipelines (local Tasks, Artifact Hub, and remote URLs)
4141

docs/content/docs/guide/gitops_commands.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The advantage of using a `GitOps command` is that it provides a journal of all t
1010

1111
## GitOps Commands on Pull Requests
1212

13-
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.
13+
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.
1414

1515
Example:
1616

@@ -21,6 +21,21 @@ failure is not with your PR but seems to be an infrastructure issue.
2121
/retest
2222
```
2323

24+
The `/retest` command will only create new PipelineRuns if:
25+
- Previous PipelineRuns for the same commit **failed**, OR
26+
- No PipelineRuns exist for the same commit
27+
28+
If a successful PipelineRun already exists for the same commit, `/retest` will **skip** creating a new PipelineRun to avoid unnecessary duplication.
29+
30+
**To force a rerun regardless of previous status**, use:
31+
```text
32+
/retest <pipelinerun-name>
33+
```
34+
35+
This will always create a new PipelineRun, even if previous runs were successful.
36+
37+
Similar to `/retest`, the `/ok-to-test` command will only create new PipelineRuns if no successful PipelineRun already exists for the same commit. This prevents duplicate runs when repository owners repeatedly approve the same commit.
38+
2439
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:
2540

2641
```text
@@ -255,12 +270,12 @@ Here are the possible event types:
255270

256271
* `test-all-comment`: The event is a single `/test` that would test every matched PipelineRun.
257272
* `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.
273+
* `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.
259274
* `retest-comment`: The event is a `/retest <PipelineRun>` that would retest a specific PipelineRun.
260275
* `on-comment`: The event is coming from a custom comment that would trigger a PipelineRun.
261276
* `cancel-all-comment`: The event is a single `/cancel` that would cancel every matched PipelineRun.
262277
* `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.
278+
* `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.
264279

265280
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.
266281

docs/content/docs/guide/policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ or other supported Git providers (currently GitHub and Gitea).
2323
to trigger the CI for a pull request by commenting `/ok-to-test`. This enables
2424
CI to run on pull requests submitted by contributors who are not collaborators
2525
of the repository or organization. It also applies to `/test` and `/retest`
26-
commands. This action takes precedence over the `pull_request` action.
26+
commands. Note that `/retest` will only create new PipelineRuns if previous runs failed. This action takes precedence over the `pull_request` action.
2727

2828
## Configuring Policies in the Repository CR
2929

0 commit comments

Comments
 (0)