Skip to content

Commit

Permalink
rhtap: fix update-deployment condition
Browse files Browse the repository at this point in the history
The update-deployment task is supposed to run on push. Rather than
excluding the task for "pull_request" and "Merge Request" event types,
run the task only for "push" and "Push" event types.

---

Based on the pipelines-as-code codebase [1], mainly
pkg/provider/*/parse_payload.go, the possible events and their
corresponding event_type values are:

|                | anything except gitlab            | gitlab
|----------------|-----------------------------------|---------------
| PR             | pull_request                      | Merge Request
| PR comment     | pull_request*                     | pull_request**
| push           | push                              | Push
| tag push       | push                              | Tag Push
| commit comment | push (only github)                | N/A
| rerun button   | pull_request / push (only github) | N/A

* Depending on the Pipelines as Code version, PR comments may get
  categorized into many different event_types [2]. In version v0.27.2
  (latest as of the date of this commit), they result in a pull_request
  event. See https://issues.redhat.com/browse/SRVKP-5775.

** In version v0.27.2, gitlab MR comments get the pull_request
   event_type due to the workaround for SRVKP-5775. Prior to version
   v0.25.0, they used to get the Note event_type. Between these
   versions, the would get one of the comment-specific event types [2].

---

Summary: the update-deployment task will run for pushes, manual reruns
of push pipelines (github only) and commit comments (github only). For
providers other than gitlab, the task may also run on tag pushes if the
PipelineRun is configured to respond to those. But we generally don't
expect this pipeline to run for tag pushes (users shouldn't configure
their PipelineRun that way).

[1]: https://github.com/openshift-pipelines/pipelines-as-code
[2]: https://pipelinesascode.com/docs/guide/gitops_commands/#event-type-annotation-and-dynamic-variables

Signed-off-by: Adam Cmiel <[email protected]>
  • Loading branch information
chmeliik committed Sep 19, 2024
1 parent 4ebae9b commit bed985c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pipelines/docker-build-rhtap/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@
- update-deployment
when:
- input: "$(params.event-type)"
operator: notin
values: ["pull_request", "Merge Request"]
operator: in
values:
- "push" # all providers other than gitlab
- "Push" # gitlab
taskRef:
kind: Task
name: acs-deploy-check
Expand Down

0 comments on commit bed985c

Please sign in to comment.