-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Validate PipelineRun Parameters #2719
Conversation
This PR cannot be merged: expecting exactly one kind/ label Available
|
1 similar comment
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
0697022
to
bcf1c72
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
bcf1c72
to
4e0550c
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
4e0550c
to
8347846
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
8347846
to
13759ed
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
13759ed
to
b0a3bac
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
b0a3bac
to
9fc4144
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
9fc4144
to
264032d
Compare
This PR cannot be merged: expecting exactly one kind/ label Available
|
The following is the coverage report on the affected files.
|
264032d
to
5b8b6d2
Compare
The following is the coverage report on the affected files.
|
25120c4
to
7eab836
Compare
The following is the coverage report on the affected files.
|
7eab836
to
582f848
Compare
The following is the coverage report on the affected files.
|
thanks for the review @vdemeester and @pritidesai! made the changes and the test case with default params is here |
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.
Fantastic, this is going to make writing test infra much easier.
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.
looks great, thanks @jerop for addressing all the comments 🙏
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.
/lgtm
/hold
I just want a last look from @tektoncd/core-maintainers. This will force task to setup default value for parameters if the parameters can be an empty string.
# […]
spec:
params:
- name: extraOptions
type: string
steps:
- name: foooooo
image: bash
script: |
ls -l ${extraOptions}
Without specifying the parameter extraOptions
, the above task would succeed before this change and "fail" after. We will need a pass on the catalog
to add default
field where needed.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pritidesai, sbwsg, 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 |
@vdemeester if anyone was relying on this for Pipelines + PipelineRuns we definitely want to warn them, so I think it makes sense to put a warning in the release notes. I think the catalog shouldn't need any updates b/c this PR is only updating Pipelines + PipelinesRuns, and it looks like Tasks + TaskRuns already have this validation, for example this Task:
With this TaskRun:
The TaskRun fails with:
|
While working on allowing PipelineRuns to provide extra parameters (tektoncd#2513), we found that providing extra parameters was unintentionally allowed. That's because, currently, there's no validation that all parameters expected by the Pipeline is provided by the PipelineRun. In this PR, we add validation for PipelineRun parameters by generating a list of provided parameters then iterating through the required parameters to ensure they are in the list of provided parameters. Note that parameters which have default values specified in Pipeline are not required. In the validation, we still allow PipelineRuns to provide extra parameters. If we disallow PipelineRuns from provides extra parameters, the Pipelines would fail. As a result, systems that autogenerate PipelineRuns need to lookat each pipeline to see what parameters they need so it can provide only the required parameters. That means users would have to resort to more complex designs to solve this issue, as further described in (tektoncd#2513). By allowing PipelineRuns to provide extra parameters, we make the process of autogenerating of PipelineRuns simpler. Fixes tektoncd#2708.
582f848
to
47f39ac
Compare
/lgtm |
The following is the coverage report on the affected files.
|
/retest |
Ahh good then ! It's a less scaring change 🙃 |
Changes
While working on allowing PipelineRuns to provide extra parameters (#2513), we found that providing extra parameters was unintentionally allowed. That's because, currently, there's no validation that all parameters expected by the Pipeline is provided by the PipelineRun.
In this PR, we add validation for PipelineRun parameters by generating a list of provided parameters then iterating through the expected parameters to ensure they are in the list of provided parameters. Note that parameters which have default values specified in Pipeline are not required to be provided by PipelineRun.
In the validation, we still allow PipelineRuns to provide extra parameters. If we disallow PipelineRuns from providing extra parameters, the Pipelines would fail. As a result, systems that autogenerate PipelineRuns would need to look at each pipeline to see what parameters they need so it can provide only the required parameters. That means users would have to resort to more complex designs to solve this issue, as further described in (#2513).
By allowing PipelineRuns to provide extra parameters, we make the process of autogenerating of PipelineRuns simpler.
Fixes #2708.
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.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes