-
Notifications
You must be signed in to change notification settings - Fork 121
Conversation
/assign @jerop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vincent-pli !
It's great to see this being used :)
A few small asks 🙏
- could you add "[cel]" in beginning of the commit message
- could you add a unit test too for the changes you've done?
/cc @jerop |
14a0ac3
to
b309ebb
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution to this project @vincent-pli!
I have a couple of concerns about this change:
- How can users distinguish between a static string and a context variable? In your example, a user can no longer use static strings
name
andtypes
because they'll interpreted as variable strings that are substituted withhello
andstring
respectively - In
Pipelines
, we don't substituteParameter
values withResults
from the sameTask
so doing that here would be inconsistent and confusing to users - What happens when the order of the expressions is rearranged?
- This change introduces dependencies between the
Parameters
(Expressions) which requires that users are careful about the ordering of theParameters
(Expressions) - Is the order of
Parameters
in the YAML maintained when marshalling & unmarshalling?
- This change introduces dependencies between the
One way to solve issue the first concern would be to express the context variables as variables using $(...)
to distinguish them from the static strings, that is:
# current proposal
apiVersion: tekton.dev/v1alpha1
kind: Run
metadata:
generateName: celrun-with-context-
spec:
ref:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: name
value: "'hello'"
- name: types
value: "type(name)"
- name: expression-use-context
value: "name + ' is type of ' + types"
---
# suggested proposal
apiVersion: tekton.dev/v1alpha1
kind: Run
metadata:
generateName: celrun-with-context-
spec:
ref:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: name
value: "'hello'"
- name: types
value: "type(name)"
- name: expression-use-context
value: "$(result.name) + ' is type of ' + $(result.types)"
An alternative approach I'd prefer would be to support substituting Parameters
from the Pipeline
and Results
from other Tasks
in CEL Custom Tasks
, similarly to what we do in the rest of the Pipeline
, something like:
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: example-pr-
spec:
params:
- name: name
value: "hello"
pipelineSpec:
params:
- name: name
type: string
tasks:
- name: get-type
taskRef:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: type
value: "$(params.name)"
- name: use-type
taskRef:
apiVersion: cel.tekton.dev/v1alpha1
kind: CEL
params:
- name: expression-use-type
value: "$(params.name) is of type $(tasks.get-type.results.type)"
separately, could you please add documentation updates as well to describe the change?
@jerop thanks for comments. Basically, it's what CEL expect to, the
So if we substitute expression before enter The user should use quotation(single or double) marks for static string, I means "types" and "name", without quotation will treat as variable. |
@vincent-pli thanks for the detailed response!
that's right, the parameters order is
makes sense, we can try it out and iterate as needed given it's experimental
please add documentation for this in the PR, I want to make sure that static vs variable strings is clear to users |
@jerop thanks |
@vincent-pli thank you for adding the documentation and patience on this issue!
wondering what the other CEL owners think about this, /cc @bobcatfish @imjasonh @pritidesai @bigkevmcd |
@jerop |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: Closed this PR. In response to this:
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. |
fix #716
Changes
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.