Skip to content

Commit

Permalink
Add tech preview shortcode
Browse files Browse the repository at this point in the history
And make the matching body payload a tech preview.
Explains why the behaviour may be erratics on the matching body payload
with the gitops comments.

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel authored and savitaashture committed Nov 23, 2023
1 parent 2217f5d commit 811cf7c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/content/docs/guide/authoringprs.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ commit title on `push`

### Matching PipelineRun on body payload

{{< tech_preview "Matching PipelineRun on body payload" >}}

The payload body as passed by the Git provider is available in the CEL
variable as `body` and you can use this expression to do any filtering on
anything the Git provider is sending over:
Expand All @@ -213,6 +215,31 @@ will only match if the pull request is targeting the `main` branch, the author
of the pull request is called `superuser` and the action is `synchronize` (ie:
an update occurred on a pull request)

{{< hint info >}}
When matching the body payload in a Pull Request, the GitOps comments such as
`/retest` won't be working as expected.

The payload body will become of the comment and not the original pull request
payload.

Consequently, when a pull request event occurs, like opening or updating a pull
request, the CEL body payload may not align with the defined specifications.

To be able to retest your Pull Request when using a CEL on bod payload,
you can make a dummy update to the Pull Request by sending a new SHA with this
git command:

```bash
# assuming you are on the branch you want to retest
# and the upstream remote are set
git commit --amend --no-edit && \
git push --force-with-lease
```

or close/open the pull request.

{{< /hint >}}

### Matching PipelineRun on request header

You can do some further filtering on the headers as passed by the Git provider
Expand Down
8 changes: 8 additions & 0 deletions docs/layouts/shortcodes/tech_preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<blockquote class="book-hint danger">
<b>{{ .Get 0 }}</b> is a <b>Technology Preview</b> feature only. Technology Preview features
are not currently supported and might not be functionally complete. We do
not recommend using them in production. These features provide early access
to an upcoming Pipelines-as-Code features, enabling you to test functionality
and provide feedback during the development process.
</blockquote>

0 comments on commit 811cf7c

Please sign in to comment.