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

Support for single-quote bracket notation for params #4268

Merged
merged 1 commit into from
Oct 5, 2021
Merged

Support for single-quote bracket notation for params #4268

merged 1 commit into from
Oct 5, 2021

Conversation

skaegi
Copy link
Contributor

@skaegi skaegi commented Sep 30, 2021

This change adds single-quote bracket notation to the work done in #4215. This is consistent with how referencing is done elsewhere in K8s in the downwards api.

The original patch used the name subscript notation to describe this however the standard name for this approach is bracket notation and updates the doc accordingly.

This is based on TEP: tektoncd/community#503 -- which also needs to be aligned with the two bracket notation approaches in the implementation. See tektoncd/community#527

Changes

This change adds single-quote bracket param matching to the params and param results analagous with the double-quote bracket param matching. It also adds similar test cases and updates the doc with the single-quote syntax.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in or deleted (only if no user facing changes)

Release Notes

Params and result can now be referenced with bracket notation using both single and double quotes in addition to dot notation. For example, the following are equivalent:  $(param.myparam), $(param['myparam']), and $(param["myparam"]). Bracket notation has the additional benefit of allowing users to work with parameter names containing conflicting characters like "." (e.g. $(param['my.param']) or $(param["my.param"]).

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 30, 2021
@skaegi
Copy link
Contributor Author

skaegi commented Sep 30, 2021

/kind feature

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. 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 Sep 30, 2021
@pritidesai
Copy link
Member

thanks @skaegi for implementing this feature, I have left a comment to add one unit test and will be great if you can update the proposal with the bracket notation:

Proposal has:

  steps:
    - image: $(params[dev.mattmoor.foo])

Correct it to use bracket notation with double quotes:

  steps:
    - image: $(params["dev.mattmoor.foo"])

And bracket notation with single quotes:

  steps:
    - image: $(params['dev.mattmoor.foo'])

/approve

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

Putting on a brief hold to collect feedback from the other maintainers, have added to the agenda in the next API WG.

thanks @skaegi for your patience 🙏

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 1, 2021
This change adds single-quote bracket notation to the work done in #4215. This is consistent with how referencing is done else in K8s in the downwards api.

The original patch used the name subscript notation to describe this however the standard name for this approach is bracket notation and updates the doc accordingly.
@pritidesai
Copy link
Member

/test pull-tekton-pipeline-alpha-integration-tests

@pritidesai
Copy link
Member

thanks @skaegi for updating the proposal with the correct syntax. Based on the discussion in the API WG (10/04), I am cancelling the hold 🙏

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 2021
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai, 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:
  • OWNERS [pritidesai,vdemeester]

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

@pritidesai
Copy link
Member

thanks @vdemeester for approving, changing my approval to lgtm 🙏

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2021
@jerop
Copy link
Member

jerop commented Oct 5, 2021

thanks @skaegi

/lgtm

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

5 participants