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
| body | The full payload body (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) |`{{body.pull_request.user.email }}`|<email@domain.com>|
53
-
| event_type | The event type (eg: `pull_request` or `push`) |`{{event_type}}`| pull_request (see the note for GitOps Comments [here]({{< relref "/docs/guide/gitops_commands.md#event-type-annotation-and-dynamic-variables" >}}) ) |
54
-
| git_auth_secret | The secret name auto-generated with provider token to check out private repos. |`{{git_auth_secret}}`| pac-gitauth-xkxkx |
55
-
| headers | The request headers (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) |`{{headers['x-github-event']}}`| push |
56
-
| pull_request_number | The pull or merge request number, only defined when we are in a `pull_request` event or push event occurred when pull request is merged. |`{{pull_request_number}}`| 1 |
57
-
| repo_name | The repository name. |`{{repo_name}}`| pipelines-as-code |
58
-
| repo_owner | The repository owner in the git provider. (For VCS providers with owner hierarchies, e.g. GitLab's orgs; namespaces; groups; and subgroups, the full ownership slug is used) |`{{repo_owner}}`| openshift-pipelines |
59
-
| repo_url | The repository full URL. |`{{repo_url}}`|<https://github.com/openshift-pipelines/pipelines-as-code>|
60
-
| revision | The commit full sha revision. |`{{revision}}`| 1234567890abcdef |
61
-
| sender | The sender username (or account ID on some providers) of the commit. |`{{sender}}`| johndoe |
62
-
| source_branch | The branch name where the event comes from. |`{{source_branch}}`| main |
63
-
| git_tag | The Git tag pushed (only available for tag push events; otherwise empty `""`). |`{{git_tag}}`| v1.0 |
64
-
| source_url | The source repository URL from where the event comes (same as the value `repo_url` for push events). |`{{source_url}}`|<https://github.com/openshift-pipelines/pipelines-as-code>|
65
-
| target_branch | The branch name on which the event targets (same as `source_branch` for push events). |`{{target_branch}}`| main |
66
-
| target_namespace | The target namespace where the Repository has matched and the PipelineRun will be created. |`{{target_namespace}}`| my-namespace |
67
-
| trigger_comment | The comment triggering the PipelineRun when using a [GitOps command]({{< relref "/docs/guide/running.md#gitops-command-on-pull-or-merge-request" >}}) (like `/test`, `/retest`) |`{{trigger_comment}}`| /merge-pr branch |
68
-
| pull_request_labels | The labels of the pull request separated by a newline |`{{pull_request_labels}}`| bugs\nenhancement |
50
+
| Variable | Description | Example | Example Output|
| body | The full payload body (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) |`{{body.pull_request.user.email }}`|<email@domain.com>|
53
+
| event_type | The event type (eg: `pull_request` or `push`) |`{{event_type}}`| pull_request (see the note for GitOps Comments [here]({{< relref "/docs/guide/gitops_commands.md#event-type-annotation-and-dynamic-variables" >}}) )|
54
+
| git_auth_secret | The secret name auto-generated with provider token to check out private repos. |`{{git_auth_secret}}`| pac-gitauth-xkxkx|
55
+
| headers | The request headers (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) |`{{headers['x-github-event']}}`| push|
56
+
| pull_request_number | The pull or merge request number, only defined when we are in a `pull_request` event or push event occurred when pull request is merged. |`{{pull_request_number}}`| 1|
57
+
| repo_name | The repository name. |`{{repo_name}}`| pipelines-as-code|
58
+
| repo_owner | The repository owner in the git provider. (For VCS providers with owner hierarchies, e.g. GitLab's orgs; namespaces; groups; and subgroups, the full ownership slug is used) |`{{repo_owner}}`| openshift-pipelines|
59
+
| repo_url | The repository full URL. |`{{repo_url}}`|<https://github.com/openshift-pipelines/pipelines-as-code>|
60
+
| revision | The commit full sha revision. |`{{revision}}`| 1234567890abcdef|
61
+
| sender | The sender username (or account ID on some providers) of the commit. |`{{sender}}`| johndoe|
62
+
| source_branch | The branch name where the event comes from. |`{{source_branch}}`| main|
63
+
| git_tag | The Git tag pushed (only available for tag push events; otherwise empty `""`). |`{{git_tag}}`| v1.0|
64
+
| source_url | The source repository URL from where the event comes (same as the value `repo_url` for push events). |`{{source_url}}`|<https://github.com/openshift-pipelines/pipelines-as-code>|
65
+
| target_branch | The branch name on which the event targets (same as `source_branch` for push events). |`{{target_branch}}`| main|
66
+
| target_namespace | The target namespace where the Repository has matched and the PipelineRun will be created. |`{{target_namespace}}`| my-namespace|
67
+
| trigger_comment | The comment triggering the PipelineRun when using a [GitOps command]({{< relref "/docs/guide/running.md#gitops-command-on-pull-or-merge-request" >}}) (like `/test`, `/retest`) |`{{trigger_comment}}`| /merge-pr branch|
68
+
| pull_request_labels | The labels of the pull request separated by a newline |`{{pull_request_labels}}`| bugs\nenhancement|
69
69
70
70
Note: When using the `{{ pull_request_number }}` variable in a push-triggered PipelineRun when a pull request is merged and the commit is associated with multiple pull requests
71
71
the git provider API may return more than one pull request. In such cases, the `{{ pull_request_number }}` variable will contain the number of the first pull request returned by the API.
Copy file name to clipboardExpand all lines: docs/content/docs/guide/gitops_commands.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,41 @@ This will always trigger a new PipelineRun, even if previous runs were successfu
39
39
40
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
41
42
+
### Requiring a SHA with `/ok-to-test`
43
+
44
+
{{< tech_preview "Requiring a SHA argument to `/ok-to-test`" >}}
Cluster administrators can enforce SHA validation on `/ok-to-test` by setting
48
+
`require-ok-to-test-sha: "true"` in the Pipelines-as-Code ConfigMap. This
49
+
feature currently applies only to GitHub, as its `issue_comment` event does not
50
+
include the pull request’s HEAD SHA (unlike other providers that do).
51
+
52
+
Without this SHA, a small timing window exists where an attacker could push a
53
+
new commit immediately after an owner comments `/ok-to-test`, causing CI to run
54
+
on unintended code. Requiring the reviewer to include the commit ID eliminates
55
+
this risk until GitHub includes the SHA in its webhook payload.
56
+
57
+
When enabled, repository owners and collaborators must append a 7–40 character
58
+
Git SHA (in lowercase or uppercase hexadecimal) to the command, for example:
59
+
60
+
```text
61
+
/ok-to-test 1A2B3C4
62
+
```
63
+
64
+
Pipelines-as-Code verifies the provided SHA against the pull request’s current HEAD:
65
+
66
+
- Short SHAs must match the HEAD commit’s prefix.
67
+
- Full SHAs must match exactly.
68
+
69
+
If the SHA is missing or invalid, the comment is rejected, and the bot replies
70
+
with instructions to retry using the correct value. This mechanism protects
71
+
GitHub repositories from the time-of-check/time-of-use vulnerability,
72
+
a risk that other providers avoid by including the commit SHA directly in the
73
+
webhook payload.
74
+
75
+
### Targeting Specific PipelineRuns
76
+
42
77
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:
0 commit comments