-
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
fix an issue with InvalidMatrixParameterTypes
along with updating the matrix example with additional validations
#7064
Conversation
d852d1d
to
ed441e7
Compare
This is not a flake :(
The This Why is |
ed441e7
to
d0e7f68
Compare
/kind bug |
InvalidMatrixParameterTypes
along with updating the matrix example with additional validations
InvalidMatrixParameterTypes
along with updating the matrix example with additional validationsInvalidMatrixParameterTypes
along with updating the matrix example with additional validations
d0e7f68
to
b70ea8a
Compare
b70ea8a
to
06faa10
Compare
@@ -8558,7 +8606,7 @@ spec: | |||
} | |||
|
|||
if len(taskRuns.Items) != 9 { |
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.
if len(taskRuns.Items) != 9 { | |
if len(taskRuns.Items) != 10 { |
Should this be updated to 10?
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.
taskRuns
is retrieving a list of taskRuns created for a matrix
pipelineTask platforms-and-browsers
and expected that the reconciler creates 9 taskRuns. I have reverted the changes to the error message to reflect the right number.
If needed, we can change this a little bit more to also retrieve taskRun for the other matrix pipelineTask and make sure it only creates one taskRun.
Fixing a bug with InvalidMatrixParameterType when a parameter is not part of a matrix but defined as a task parameter of type string, pipelineRun results in a failure. Adding two new validation: * onError with matrix: when a task fan out for a given number of instances, pipeline controller must apply the onError to each running instance. * retry with matrix: when a task has specified retry, that specification must apply to all the instances of fanned out task. Being consistent with the rest of the reasons, dropping "Reason" from "ReasonInvalidMatrixParameterTypes". Updated the error reported in "ValidateParameterTypesInMatrix" to include name of the pipelineTask. Co-authored-by: EmmaMunley <emmamunley@google.com> Signed-off-by: Priti Desai <pdesai@us.ibm.com>
06faa10
to
b4f27e0
Compare
@@ -159,7 +159,7 @@ func ApplyPipelineTaskContexts(pt *v1.PipelineTask) *v1.PipelineTask { | |||
} | |||
pt.Params = pt.Params.ReplaceVariables(replacements, map[string][]string{}, map[string]map[string]string{}) | |||
if pt.IsMatrixed() { | |||
pt.Matrix.Params = pt.Params.ReplaceVariables(replacements, map[string][]string{}, map[string]map[string]string{}) | |||
pt.Matrix.Params = pt.Matrix.Params.ReplaceVariables(replacements, map[string][]string{}, map[string]map[string]string{}) |
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.
do we have unit tests in apply_test.go to cover this?
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.
The existing unit tests does cover this.
But the existing test was not able to catch this issue. This bug surfaces when a non-matrix parameter (which can be of any type) is added to the list of params belonging to a matrix (only arrays are allowed). We have added a test to catch this error (parameters of type array only are allowed, but param version has type string
) and address it as part of this PR.
If we want to still add a test local unit test, we could add the following test case. I think this is not necessary. Let me know you think.
description: "matrix params are not overwritten by the params",
pt: v1.PipelineTask{
Params: v1.Params{{
Name: "params-1",
Value: *v1.NewStructuredValues("0"),
}},
Matrix: &v1.Matrix{
Params: v1.Params{{
Name: "params-2",
Value: *v1.NewStructuredValues("5"),
}},
},
},
want: v1.PipelineTask{
Params: v1.Params{{
Name: "params-1",
Value: *v1.NewStructuredValues("0"),
}},
Matrix: &v1.Matrix{
Params: v1.Params{{
Name: "params-2",
Value: *v1.NewStructuredValues("5"),
}},
},
kind: TaskRun | ||
name: pr-matrix-with-onerror-3 | ||
pipelineTaskName: matrix-with-onerror | ||
provenance: |
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.
non-blocking: I wonder if it makes sense to ignore the provenance fields for these 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.
sure @dibyom I will open a separate PR to clean up provenance fields as its part of many other 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.
/lgtm
thank you @pritidesai!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, jerop 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 |
Changes
Fixing an issue where the
ApplyPipelineTaskContexts
had bug inReplaceVariables
with replacingmatrix.params
with justparams
instead ofmatrix.params
Adding two new validations:
onError with matrix: when a task fan out for a given number of instances, pipeline controller must apply the onError to each running instance.
retry with matrix: when a task has specified retry, that specification must apply to all the instances of fanned out task.
Being consistent with the rest of the reasons, dropping "Reason" from "ReasonInvalidMatrixParameterTypes".
Updated the error reported in "ValidateParameterTypesInMatrix" to include name of the pipelineTask.
Co-authored-by: EmmaMunley emmamunley@google.com
Closes #7070
/kind bug
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