-
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
Remove duplicate code for validating params types and defaults #4872
Remove duplicate code for validating params types and defaults #4872
Conversation
/test pull-tekton-pipeline-alpha-integration-tests |
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 Chuang! I think it could make sense to move parameter validation out of task_validation.go and pipeline_validation.go into a new param_validation.go file since a lot of the param code seems to be duplicated between pipeline and task validation.
Hi @lbernick , Would you recommend we also refactor reconciler level to extract a dedicated file? If so, I am happy to do that after finishing the refactor of this validation webhook level. |
Just thinking that moving param validation related functions to a new file will be a big change for other existing PRs like #4867 #4861 since they are modifying the param validation functions in the original file. |
Prior to this commit, PipelineSpec's ParamSpec type validation was reimplemented in pipeline_validation.go, which actually has been implemented in task_validation.go for the ParamSpec's type validation. So in this commit, we replace the duplicate code with existing function.
60cb8f7
to
2f3fd4a
Compare
/test pull-tekton-pipeline-alpha-integration-tests |
That could definitely make sense! We have something similar for workspaces I think. Agree that it should be a separate PR.
Up to you! I think if you are going to the trouble of making a cleanup PR it's worth putting these functions in the place that makes the most sense (right now this PR is having the pipeline validation use a function defined in task validation which feels a bit strange to me). Rebasing and resolving merge conflicts is sort of a fact of life :) but if you'd prefer to wait that's OK too. |
/assign ywluogg |
@chuangw6 maybe change the PR naming to be specifically to "remove duplicate code for validating params types and defaults" to narrow down the cleanup scope. You can create a separate PR for workspaces |
/lgtm |
@ywluogg: changing LGTM is restricted to collaborators In response to this:
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. |
great point! Done! |
/approve |
[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 |
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
/kind misc |
Changes
Prior to this commit,
PipelineSpec
'sParamSpec
type validationwas re-implemented in
pipeline_validation.go
, which actually hasbeen implemented in
task_validation.go
for theParamSpec
's typevalidation.
So in this commit, we replace the duplicate code with existing function.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
(if there are no user facing changes, use release note "NONE")
Release Notes