-
Notifications
You must be signed in to change notification settings - Fork 426
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
Support for dynamic params to TriggerTemplates beyond just event values #87
Comments
I like it! Might be a noob questions, but would we need to explicitly list all fields in e.g. for the examples you gave above, being able to reference the ParamBinding in the TriggerBinding:
For filtering, this may not solve all problems since we might want to make some bindings conditional (e.g. don't call out to GitHub to check membership if we don't even care about the repo). |
In the case of creating a release, there is no event to process? A "manual" |
I think having additional parameters exterior to the event might be unavoidable though and we wouldn't want to ruin re-usability. To this point, the initial thought is to push more into the |
Also, this gets at the discussion of reusability in general and how much there really is. Spoke with @ncskier about this yesterday and a |
@bobcatfish Do you feel that this has been "solved" by adding interceptors as well as static parameters in the |
The way I implemented this for now is an I could do the same with an interceptor, but it's not clear for me yet how to best use them. |
In PR #438, a discussion started about the use-case of chaining Interceptors: #438 (comment)
The use-case described made me think about this issue, and whether it should be the job of an Interceptor to "call out" for additional information, or if we need a separate mechanism in Triggers for this. Interceptors were initially built as a way to validate events. However, their role has now grown to include calling out for additional information (the feature called "dynamic params" in this issue). If we're happy with Interceptors taking on this dual-role, then we can close this issue. However, I think that it would be helpful to revisit this issue, because @afrittoli raised some good points about why we might not want to use Interceptors to get "dynamic params" :
I'm interested to know if anything about this issue has changed since it was last discussed in October 😅 |
I think with the inclusion of WebhookInterceptors we can close this out.
I think #270 will help this. You can either provide a Service, or a URL (where you could host multiple interceptor endpoints). I suspect possibly adding a URL path to Services may also help this out this particular case, this way you could deploy a single Service and route accordingly. I suspect this is an area we can learn from Knative Addressables (e.g. https://github.com/knative/pkg/blob/d9a38f13e8b9aa736f714b793ee28788de1b30e0/apis/duck/v1beta1/destination.go#L26-L47) |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
I agree. Interceptors (both CEL overlays + Webhooks) can modify the event body and add extra "dynamic" parameters |
Expected Behavior
It should (maybe!) be possible for users to provide values to
TriggerTemplate
from sources other than eventsActual Behavior
A TriggerTemplate takes parameters, and doesn't need to worry about where those come from e.g.:
At the moment these values can be provided only by a TriggerBinding which can extract them from json data (an event):
There is no other way to provide values for the params of a
TriggerTemplate
.Steps to Reproduce the Problem
For dogfooding Tekton Pipelines, I wanted to make use of this the Pipeline we have been using for manual releases. However the Pipeline takes a parameter called
versionTag
:https://github.com/tektoncd/pipeline/blob/3950521325d4744760a96c18e3d0c67d86495af3/tekton/publish.yaml#L14-L15
There are different types of values we want for this:
v0.4
) and number of commits so far (i.e. each subsequent commit bumps the patch value, e.g.v0.4.1
)vYYYYMMDD-commitsha
)With the current implementation for Triggers (and Prow!), in order to accomplish the above, we need to modify the Pipeline itself to do this. And we'd need either 2 totally different Pipelines or a flag to distinguish between the official + nightly use cases.
My opinion is that it's reasonable to create a Pipeline like this that takes a version parameter without being concerned with how to create it, and I think it makes sense for the Triggering system to be able to make this data available.
Additional info
Here is a proposal for how we could do this:
TriggerBinding
would specifically be about extracting values from Events only, so it could be renamed (Proposal to rename TriggerBinding #62) to something likeEventParser
orParmsFromEvent
or something better but specifcally about "events" -EventBinding
?E.g. EventListener could look like this:
nightly-version-binding
would be an instance of at type called something likeParamBinding
that is a container specification - the interface would be something like the container has to write a json file to an expected location with the values it exports, e.g. something like:In the future, we could even extend this to support cases like filtering! For example @wlynch has been looking into use cases where we need additional info from github to make a decision, e.g. "is the user who opened the PR a member of the organziation". We could use something like this to provide inputs to the filtering logic.
And this could be extended to allow for caching info - to continue the use case from (3), say we wanted to know if the user who opened the PR is a member of the org - we could have a mechanism that is caching data like this from GitHub.
What I like about (3) and (4) is that it make it possible to separate the responsibilities of obtaining data from the responsibility of acting on that data.
The text was updated successfully, but these errors were encountered: