-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add more details for param variable replacement as a whole in TEP076 #707
Conversation
/assign dibyom |
/assign wlynch |
395dcad
to
aca2223
Compare
This will also be summarized in #4723 |
Co-authored-by: Yongxuan Zhang <[email protected]>
params: | ||
- name: environments | ||
value: | ||
- '$(tasks.get-environments.results.environments[*])' |
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.
I can see another benefit of supporting this in array is that we can append several results. But for Object it may not be so helpful? @chuangw6 thinks we shouldn't add support for this
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.
For array, this variable replacement makes sense to me.
For object, it's different. I'll discuss with you offline.
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.
Yes. I should've be more clear about this, but since 0076 is all around arrays, so I will only focus on examples for arrays. I will open another PR for 0075 if necessary, once we finalize our discussions in tektoncd/pipeline#4879
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.
to be clear, this is an alternative approach right?
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.
FWIW, I'd interpret this syntax as "an array element that holds an array", which is different than the previous 2 examples. Nested arrays are a non-goal for this PR, so perhaps we should omit this?
Thank you @ywluogg!! |
- name: update-all-environments | ||
params: | ||
- name: environments | ||
value: $(tasks.get-environments.results.environments[*]) |
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.
I think the first two examples are overlapping. We don't need to distinguish whether the variable reference is quoted or not. It's just K8s default behaviour to treat any value as string if it's not array or dictionary no matter if it is quoted (doc). i.e.
params:
- name: environments
value: abc
is equivalent to
params:
- name: environments
value: "abc"
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.
I think the first two examples are overlapping. We don't need to distinguish whether the variable reference is quoted or not. It's just K8s default behaviour to treat any value as string if it's not array or dictionary no matter if it is quoted (doc).
I believe that the yaml and json conversions are through K8S API (OpenAPI) and it is generated through swagger.json
And the value field under params is marshaled and unmarshaled by the implemented json.Unmarshaller interface
in params_types.go
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.
Is there a functional difference between how value: foo
and value: "foo"
is interpreted though? (e.g. they would come in as a string, but we'd recognize the [*] syntax and treat it like an array)
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.
/kind tep
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 adding the examples.
/approve
params: | ||
- name: environments | ||
value: | ||
- '$(tasks.get-environments.results.environments[*])' |
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.
to be clear, this is an alternative approach right?
API WG - waiting for the approval from @wlynch |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, vdemeester 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 |
@ywluogg is this ok to be merged or are there still open questions? |
Add more details for param variable replacement as a whole in TEP076
When elements in params of type arrays, it should be use variable replacements in three ways