tektoncd / triggers

Event triggering with Tekton!
Apache License 2.0
552 stars 416 forks source link

Allow Event Listener to Filter on Ingress URL #1637

Closed chriscannon closed 11 months ago

chriscannon commented 1 year ago

Feature request

I would like a way for an event listener to filter the requests it responds to by looking at the ingress URL.

Use case

In my use case I have a pipeline that is almost identical except for the fact that it uses a different tekton.dev/git-0 ssh-privatekey depending on the request type. My thought was that I could do this type of filtering by what's in the payload, but then realized I need to set the serviceAccountName that's associated with the ssh-privatekey secret at the TriggerTemplate level, which means that it has to be tied 1:1 with the Event Listener. Since an Event Listener listens on all ingress URLs there's no way to filter out which trigger is called.

bigkevmcd commented 11 months ago

Have you tried adding a CEL filter?

The Request URL is available in the requestURL https://tekton.dev/docs/triggers/cel_expressions/#list-of-extensions and you can add a filter to not process the interceptor if the requestURL doesn't match some element?

https://tekton.dev/docs/triggers/interceptors/#cel-interceptors

chriscannon commented 11 months ago

Awesome I will give that a try!