Skip to content
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

CEL expressions in TriggerBindings #367

Closed
bigkevmcd opened this issue Jan 21, 2020 · 13 comments
Closed

CEL expressions in TriggerBindings #367

bigkevmcd opened this issue Jan 21, 2020 · 13 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. maybe-next-milestone

Comments

@bigkevmcd
Copy link
Member

Being able apply functions to the hook bodies in the trigger bindings might be useful.

Perhaps prefixing the expressions?

I think this can probably mostly be done with the CEL interceptor (with the the overlays functionality) so this might be an easy way around this.

apiVersion: tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
  name: my-trigger-binding
spec:
  params:
  - name: shortsha
    value: cel:(truncate(body.pull_request.head.ref, 8))
@dibyom
Copy link
Member

dibyom commented Jan 21, 2020

/kind feature
/area api

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 21, 2020
@ncskier ncskier added this to the Triggers 0.3 milestone Jan 28, 2020
@ncskier
Copy link
Member

ncskier commented Jan 28, 2020

Might need some discussion about replacing JSONPath or supporting both

@wlynch
Copy link
Member

wlynch commented Feb 4, 2020

Previous discussion: #178 (comment)

@dibyom
Copy link
Member

dibyom commented Feb 18, 2020

At the Feb 11 WG, we decided we can push this after the 0.3 milestone

@bitsofinfo
Copy link
Contributor

would love this!

@tekton-robot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Aug 13, 2020
@tekton-robot
Copy link

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dibyom
Copy link
Member

dibyom commented Aug 14, 2020

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Aug 14, 2020
@Fantaztig
Copy link

@dibyom I was just trying to find out why this isn't supported yet, do you maybe have some discussion that you could link in this issue? 😄
Since it's been frozen for almost 4 years now, it seems like it's not as easy as it seems!

@bigkevmcd
Copy link
Member Author

@Fantaztig Do you have a specific use-case in mind?

I suspect most of this can be done with a CEL "overlays"?

@Fantaztig
Copy link

It's not really a big issue, more a cosmetic thing.
Currently we extract most of the webhook data we need inside the TriggerBinding e.g. via $(body.changes[0].ref.displayId).
Some info needs some light processing though, e.g. body.pullRequest.fromRef.displayId.split('/')[1], those we have inside the EventListener right now as overlays.

What I dislike a bit about that is that

  • a) some of the overlays in the EventListener are quite redundant as they are always the same for the same TriggerBinding.
  • b) the TriggerBinding has a mix of both expressions accessing data from the payload and those simply remapping the info returned by the EventListener which means I need to check two different files to know what data is actually loaded into which param.

I'm open to alternative approaches though, is the best practice to have all the value extraction inside the EventListener despite the redundancy? Or is there another way? 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. maybe-next-milestone
Projects
None yet
Development

No branches or pull requests

7 participants