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

Add more details for param variable replacement as a whole in TEP076 #707

Merged
merged 3 commits into from
Aug 22, 2022

Conversation

ywluogg
Copy link
Contributor

@ywluogg ywluogg commented May 17, 2022

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

@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 17, 2022
@ywluogg
Copy link
Contributor Author

ywluogg commented May 17, 2022

/assign dibyom

@ywluogg
Copy link
Contributor Author

ywluogg commented May 17, 2022

/assign wlynch

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 17, 2022
@ywluogg
Copy link
Contributor Author

ywluogg commented May 17, 2022

@Yongxuanzhang

@ywluogg
Copy link
Contributor Author

ywluogg commented May 17, 2022

This will also be summarized in #4723

params:
- name: environments
value:
- '$(tasks.get-environments.results.environments[*])'
Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Member

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?

@Yongxuanzhang
Copy link
Member

@Yongxuanzhang

Thank you @ywluogg!!

- name: update-all-environments
params:
- name: environments
value: $(tasks.get-environments.results.environments[*])
Copy link
Member

@chuangw6 chuangw6 May 17, 2022

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"

Copy link
Contributor Author

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

Copy link
Member

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)

Copy link
Member

@jerop jerop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/kind tep

@tekton-robot tekton-robot added the kind/tep Categorizes issue or PR as related to a TEP (or needs a TEP). label Jun 27, 2022
Copy link
Member

@dibyom dibyom left a 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[*])'
Copy link
Member

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?

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2022
@pritidesai
Copy link
Member

API WG - waiting for the approval from @wlynch

@tekton-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dibyom
Copy link
Member

dibyom commented Aug 11, 2022

@chuangw6 @wlynch anything remaining on this before we can merge?

@dibyom
Copy link
Member

dibyom commented Aug 15, 2022

@ywluogg is this ok to be merged or are there still open questions?

@jerop
Copy link
Member

jerop commented Aug 22, 2022

API WG 08/22

@ywluogg address the open questions from @wlynch

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2022
@tekton-robot tekton-robot merged commit 5140c67 into tektoncd:main Aug 22, 2022
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/tep Categorizes issue or PR as related to a TEP (or needs a TEP). lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Status: UnAssigned
Development

Successfully merging this pull request may close these issues.

9 participants