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

[TEP-0076] Add indexing into array for pipeline params reference #4855

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented May 11, 2022

Changes

This commit provides the indexing into array for params for pipeline level reference and gated by
alpha feature flag. Before this commit we can only refer to the whole
array param, with this feature we can refer to array's element such as
$(params.param-name[i]).

/kind feature

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
    (if there are no user facing changes, use release note "NONE")

Release Notes

Indexing into array for pipeline params is now an alpha feature, element of array params can be accessed via $(params.param-name[i]).

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 11, 2022
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 11, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@Yongxuanzhang
Copy link
Member Author

/assign @ywluogg
Realized that this is independent but also part of tep0076

@tekton-robot
Copy link
Collaborator

@Yongxuanzhang: GitHub didn't allow me to assign the following users: ywluogg.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @ywluogg
Realized that this is independent but also part of tep0076

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.

@Yongxuanzhang
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

@ywluogg
Copy link
Contributor

ywluogg commented May 11, 2022

/assign ywluogg

@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review May 11, 2022 15:17
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 11, 2022
docs/variables.md Outdated Show resolved Hide resolved
pkg/reconciler/pipelinerun/resources/apply.go Show resolved Hide resolved
@@ -222,6 +222,180 @@ var (
},
}

simpleTaskSpecArrayIndexing = &v1beta1.TaskSpec{
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to add those invalid indexing cases in this PR? Something like $(params['FOO'][2]) $(params['FOO'][-1])

Copy link
Member Author

Choose a reason for hiding this comment

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

I was hesitant to add the validation because I thought it is tricky.
Right now for these out of bound cases there will be no errors, and they will be treated like string.
I will think about how to add them in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

SG! If you don't plan to add it in this PR, you can add a TODO and do it later, but we definitely need those tests for coverage and guards.

Copy link
Member

Choose a reason for hiding this comment

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

how hard would it be to add this validation? I think silently failing without errors can be confusing for users

Copy link
Member Author

@Yongxuanzhang Yongxuanzhang Jul 7, 2022

Choose a reason for hiding this comment

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

It's bit complicated, let me see if there's an easy solution

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we keep the validation in another PR? The release deadline is close

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Dibyo, I wouldn't want to hold off on adding validation just to get the feature out the door. Can you explain more about what the challenge is here?

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

Copy link
Contributor

@ywluogg ywluogg left a comment

Choose a reason for hiding this comment

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

Except for the current open comments, others LGTM

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/taskrun/resources/apply.go 99.2% 99.2% 0.0

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2022
@ywluogg
Copy link
Contributor

ywluogg commented Jun 2, 2022

Link this to #4723

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.9% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.8% -1.2
pkg/substitution/substitution.go 64.9% 64.1% -0.8

}
}

func TestValidateParamArrayIndex_invalid(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@lbernick is this the test case?

pkg/reconciler/pipelinerun/resources/validate_params.go Outdated Show resolved Hide resolved
pkg/substitution/substitution.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick, ywluogg

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

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

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.9% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.8% -1.2
pkg/substitution/substitution.go 64.9% 63.6% -1.4

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.9% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.8% -1.2
pkg/substitution/substitution.go 64.9% 63.6% -1.4

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.9% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.8% -1.2
pkg/substitution/substitution.go 60.7% 59.5% -1.1

@Yongxuanzhang
Copy link
Member Author

/retest

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 85.9% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.8% -1.2
pkg/substitution/substitution.go 60.7% 59.5% -1.1

@pritidesai pritidesai added this to the Pipelines v0.38 milestone Jul 12, 2022
@Yongxuanzhang
Copy link
Member Author

/retest

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.3% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.7% -1.3
pkg/substitution/substitution.go 60.7% 59.5% -1.1

This commit provides the indexing into array for params and gated by
alpha feature flag. Before this commit we can only refer to the whole
array param, with this feature we can refer to array's element such as
$(params.param-name[0]).
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 13, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.3% 86.1% -0.3
pkg/reconciler/pipelinerun/resources/apply.go 99.2% 99.3% 0.0
pkg/reconciler/pipelinerun/resources/validate_params.go 100.0% 98.7% -1.3
pkg/substitution/substitution.go 60.7% 61.9% 1.2

@dibyom
Copy link
Member

dibyom commented Jul 13, 2022

Thanks @Yongxuanzhang
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 13, 2022
@tekton-robot tekton-robot merged commit d3b8017 into tektoncd:main Jul 13, 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/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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants