-
Notifications
You must be signed in to change notification settings - Fork 113
fix: /ok-to-test /retest pipelineruns should not be created if last sha successful #2048
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
base: main
Are you sure you want to change the base?
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 | ||||
---|---|---|---|---|---|---|
|
@@ -10,7 +10,7 @@ | |||||
|
||||||
## GitOps Commands on Pull Requests | ||||||
|
||||||
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. | ||||||
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. | ||||||
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.
Suggested change
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. @waveywaves here and all other places in docs you've updated, I see you're mentioning only |
||||||
|
||||||
Example: | ||||||
|
||||||
|
@@ -21,6 +21,21 @@ | |||||
/retest | ||||||
``` | ||||||
|
||||||
The `/retest` command will only create new PipelineRuns if: | ||||||
- Previous PipelineRuns for the same commit **failed**, OR | ||||||
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.
Suggested change
|
||||||
- No PipelineRuns exist for the same commit | ||||||
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.
Suggested change
|
||||||
|
||||||
If a successful PipelineRun already exists for the same commit, `/retest` will **skip** creating a new PipelineRun to avoid unnecessary duplication. | ||||||
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.
Suggested change
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. @waveywaves trigger is appropriate term I guess |
||||||
|
||||||
**To force a rerun regardless of previous status**, use: | ||||||
```text | ||||||
/retest <pipelinerun-name> | ||||||
``` | ||||||
|
||||||
This will always create a new PipelineRun, even if previous runs were successful. | ||||||
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.
Suggested change
|
||||||
|
||||||
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. | ||||||
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.
Suggested change
|
||||||
|
||||||
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: | ||||||
|
||||||
```text | ||||||
|
@@ -241,10 +256,10 @@ | |||||
|
||||||
There are different formats that can be accepted, allowing you to pass values with spaces or newlines: | ||||||
|
||||||
* key=value | ||||||
* key="a value" | ||||||
* key="another \"value\" defined" | ||||||
* key="another | ||||||
value with newline" | ||||||
|
||||||
## Event Type Annotation and Dynamic Variables | ||||||
|
@@ -253,14 +268,14 @@ | |||||
|
||||||
Here are the possible event types: | ||||||
|
||||||
* `test-all-comment`: The event is a single `/test` that would test every matched PipelineRun. | ||||||
* `test-comment`: The event is a `/test <PipelineRun>` comment that would test a specific PipelineRun. | ||||||
* `retest-all-comment`: The event is a single `/retest` that would retest every matched PipelineRun. | ||||||
* `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. | ||||||
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.
Suggested change
|
||||||
* `retest-comment`: The event is a `/retest <PipelineRun>` that would retest a specific PipelineRun. | ||||||
* `on-comment`: The event is coming from a custom comment that would trigger a PipelineRun. | ||||||
* `cancel-all-comment`: The event is a single `/cancel` that would cancel every matched PipelineRun. | ||||||
* `cancel-comment`: The event is a `/cancel <PipelineRun>` that would cancel a specific PipelineRun. | ||||||
* `ok-to-test-comment`: The event is a `/ok-to-test` that would allow running the CI for an unauthorized user. | ||||||
* `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. | ||||||
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.
Suggested change
|
||||||
|
||||||
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. | ||||||
|
||||||
|
@@ -272,12 +287,12 @@ | |||||
|
||||||
When using the `{{ event_type }}` [dynamic variable]({{< relref "/docs/guide/authoringprs.md#dynamic-variables" >}}) for the following event types: | ||||||
|
||||||
* `test-all-comment` | ||||||
* `test-comment` | ||||||
* `retest-all-comment` | ||||||
* `retest-comment` | ||||||
* `cancel-all-comment` | ||||||
* `ok-to-test-comment` | ||||||
|
||||||
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. | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,7 +23,7 @@ or other supported Git providers (currently GitHub and Gitea). | |||||
to trigger the CI for a pull request by commenting `/ok-to-test`. This enables | ||||||
CI to run on pull requests submitted by contributors who are not collaborators | ||||||
of the repository or organization. It also applies to `/test` and `/retest` | ||||||
commands. This action takes precedence over the `pull_request` action. | ||||||
commands. Note that `/retest` will only create new PipelineRuns if previous runs failed. This action takes precedence over the `pull_request` action. | ||||||
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.
Suggested change
|
||||||
|
||||||
## Configuring Policies in the Repository CR | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,8 +74,10 @@ get_tests() { | |
mapfile -t testfiles < <(find test/ -maxdepth 1 -name '*.go') | ||
ghglabre="Github|Gitlab|Bitbucket" | ||
if [[ ${target} == "providers" ]]; then | ||
# echo "TestGithubMaxKeepRuns" | ||
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. @waveywaves I think this is added mistakenly? |
||
grep -hioP "^func Test.*(${ghglabre})(\w+)\(" "${testfiles[@]}" | sed -e 's/func[ ]*//' -e 's/($//' | ||
elif [[ ${target} == "gitea_others" ]]; then | ||
elif [[ ${target} == "gitea_others" ]]; then | ||
# echo "TestGiteaParamsOnRepoCR" | ||
grep -hioP '^func Test(\w+)\(' "${testfiles[@]}" | grep -iPv "(${ghglabre})" | sed -e 's/func[ ]*//' -e 's/($//' | ||
else | ||
echo "Invalid target: ${target}" | ||
|
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.