-
Notifications
You must be signed in to change notification settings - Fork 0
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 support for reserved default object param #164
base: main
Are you sure you want to change the base?
Conversation
1f81f21
to
e2e1633
Compare
taskSpec = "taskSpec" | ||
pipelineRef = "pipelineRef" | ||
pipelineSpec = "pipelineSpec" | ||
ReservedParamName = "TBD" |
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.
will add changes to v1beta1 soon
e2e1633
to
8d16c7b
Compare
@@ -132,6 +132,7 @@ func ValidateUsageOfDeclaredParameters(ctx context.Context, steps []Step, params | |||
var errs *apis.FieldError | |||
_, _, objectParams := params.SortByType() | |||
allParameterNames := sets.NewString(params.GetNames()...) | |||
allParameterNames.Insert(ReservedParamName) |
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.
May be here we should check that the ReservedParamName
is not already in the set. If it is then a user also declared it and it should throw an error since it is reserved?
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.
this check is not done from our side, there will be additional validation out of tekton and we're sure that users cannot declare the param with reserved name. :D
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.
(and we cannot do it from out side for some reason...
@@ -395,6 +396,7 @@ func (ps *PipelineSpec) validatePipelineParameterUsage(ctx context.Context) (err | |||
// validatePipelineTaskParameterUsage validates that parameters referenced in the Pipeline Tasks are declared by the Pipeline | |||
func validatePipelineTaskParameterUsage(tasks []PipelineTask, params ParamSpecs) (errs *apis.FieldError) { | |||
allParamNames := sets.NewString(params.GetNames()...) | |||
allParamNames.Insert(ReservedParamName) |
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.
May be here we should check that the ReservedParamName is not already in the set. If it is then a user also declared it and it should throw an error since it is reserved?
@@ -671,6 +671,20 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel | |||
} | |||
|
|||
if pipelineRunFacts.State.IsBeforeFirstTaskRun() { | |||
// check if the object's key names are referenced correctly i.e. param.objectParam.key1 |
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.
working on adding unit tests for this, same for taskrun. e2e tests have been added to cover this code
8d16c7b
to
0c5546b
Compare
0d050fc
to
d4fe76d
Compare
This commit adds support for reserved default object param.Users can reference to default object param values without needing to declaring them in remote Task&Pipeline. Validation err will be returned if referencing to non-existent object key. Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
d4fe76d
to
d62e1e6
Compare
Changes
This commit adds support for reserved default object param.Users can reference to default object param values without needing to declaring them in remote Task&Pipeline. Validation err will be returned if referencing to non-existent object key.
This is the PR to run all tests: tektoncd#7484
Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes