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

Expose the incoming request URL to CEL expressions. #647

Merged
merged 1 commit into from Jun 30, 2020

Conversation

bigkevmcd
Copy link
Member

Changes

This adds a requestURL key to the CEL expression context.

For example, requestURL.parseURL().path would get the path of the incoming request URL.

Fixes: #640

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

This adds a `requestURL` key to the CEL expression context.

For example, `requestURL.parseURL().path` would get the path of the incoming request URL.

This adds a `requestURL` key to the CEL expression context.

For example, `requestURL.parseURL().path` would get the path of the incoming request URL.
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 29, 2020
@dibyom
Copy link
Member

dibyom commented Jun 29, 2020

So, this adds requestURL to the CEL context. Wondering if it makes sense to add it to the TriggerBinding context as well -- I guess the only use case right now would be to use the entire url...unless we add CEL functions to TriggerBindings

/approve
/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 29, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2020
@bigkevmcd
Copy link
Member Author

So, this adds requestURL to the CEL context. Wondering if it makes sense to add it to the TriggerBinding context as well -- I guess the only use case right now would be to use the entire url...unless we add CEL functions to TriggerBindings

There's arguably value in having the requestURL in trigger bindings, if CEL functions landed in TriggerBindings, I'd be looking to refactor and reuse the same context mechanism.

@dibyom
Copy link
Member

dibyom commented Jun 30, 2020

Yeah, let's just go with the CEL context for now.

@dibyom
Copy link
Member

dibyom commented Jun 30, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 30, 2020
@tekton-robot tekton-robot merged commit d9fe09f into tektoncd:master Jun 30, 2020
@bigkevmcd bigkevmcd deleted the add-url-to-cel-context branch July 1, 2020 19:18
@lostiniceland
Copy link

I was hoping to parse query parameters using this function to easily trigger a pipeline in tekton (no need for curl or postman etc, just a browser).
I am able to use the cel filter in an EventListener but without support for this in a TriggerBinding it is useless for my case

@bigkevmcd
Copy link
Member Author

@lostiniceland you can expose the elements you need as overlays via a CEL interceptor and then use those in a binding https://tekton.dev/docs/triggers/interceptors/#cel-interceptors and https://tekton.dev/docs/triggers/triggerbindings/#accessing-data-added-by-interceptorsdocstriggersinterceptors ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CEL feature: URL extension
4 participants