-
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 param array indexing validation error reason and error log #6179
fix param array indexing validation error reason and error log #6179
Conversation
This is divided from #6120 to break it into smaller prs |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/assign |
pr.Status.MarkFailed(ReasonObjectParameterMissKeys, | ||
"PipelineRun %s/%s parameters is missing object keys required by Pipeline %s/%s's parameters: %s", | ||
pr.Status.MarkFailed(ReasonParamArrayIndexingInvalid, | ||
"PipelineRun %s/%s array indexing params fail validation by Pipeline %s/%s's parameters: %s", |
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 error message looks confusing, could you please rephrase it a little bit? Is this function ValidateParamArrayIndex
only for validating the out-of-boundary error? if so, can we make it clearer?
Thank you!
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.
It is currently out-of-boundary error, but we want to add other checks later (the feature gate check).
Besides, the error from ValidateParamArrayIndex
will also be added to this log. It will contain detailed log messages
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.
Proposed codes suggestions has been merged, so I guess we can resolve this comment thread :) Thank you
pr.Status.MarkFailed(ReasonObjectParameterMissKeys, | ||
"PipelineRun %s/%s parameters is missing object keys required by Pipeline %s/%s's parameters: %s", | ||
pr.Status.MarkFailed(ReasonParamArrayIndexingInvalid, | ||
"PipelineRun %s/%s array indexing params fail validation by Pipeline %s/%s's parameters: %s", |
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.
"PipelineRun %s/%s array indexing params fail validation by Pipeline %s/%s's parameters: %s", | |
"Failed to validate PipelineRun %s/%s: failed to validate Pipeline %s/%s's parameters: %s", |
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.
I think we cannot use "Failed" as the first word, it fails the linter of duplicate workds. 😂
The following is the coverage report on the affected files.
|
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.
Thank you @Yongxuanzhang
/lgtm
703a783
to
ae4f5a0
Compare
The following is the coverage report on the affected files.
|
/lgtm |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-beta-integration-tests This seems like a network flake:
|
Yes I have seen this a lot recently |
ae4f5a0
to
9097e36
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
permanentError: true, | ||
wantEvents: []string{ | ||
"Normal Started", | ||
"Warning Failed PipelineRun foo/pipeline-param-array-out-of-bound array indexing params fail validation: failed to validate Pipeline foo/a-pipeline-with-array-indexing-params's parameters: non-existent param references:[$(params.some-param[2]", |
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.
missing closing brackets )]
in [$(params.some-param[2]
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.
is it possible to include the length of an array and the index in the error message non-existent param references:[$(params.some-param[2]
? It will help the users to learn exactly what is the issue.
An array index \"2\" is out of bound, parameter \"some-param\" has two elements in \"$(params.some-param[2])\".
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 bracket is missed intentionally otherwise it will fail the test. Since we will read the string as regex pattern, and if I adds bracket it will lead to the error. I don't know if there's a better way
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.
is it possible to include the length of an array and the index in the error message
non-existent param references:[$(params.some-param[2]
? It will help the users to learn exactly what is the issue.An array index \"2\" is out of bound, parameter \"some-param\" has two elements in \"$(params.some-param[2])\".
That's possible and makes sense. Maybe we could update it after #6180 is merged?
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.
Can you please open an issue to track it?
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 bracket is missed intentionally otherwise it will fail the test. Since we will read the string as regex pattern, and if I adds bracket it will lead to the error. I don't know if there's a better way
It looks half baked, how is the error returned to the user when they try to create a pipelineRun?
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 bracket is missed intentionally otherwise it will fail the test. Since we will read the string as regex pattern, and if I adds bracket it will lead to the error. I don't know if there's a better way
It looks half baked, how is the error returned to the user when they try to create a pipelineRun?
I think this is just for test purpose, the regex function is only used in tests to check the events. Since event is complicated so it uses regex to match the content of the event. The users should be able to see the full events
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.
Can you please open an issue to track it?
Sure!
pr.Status.MarkFailed(ReasonObjectParameterMissKeys, | ||
"PipelineRun %s/%s parameters is missing object keys required by Pipeline %s/%s's parameters: %s", | ||
pr.Status.MarkFailed(ReasonParamArrayIndexingInvalid, | ||
"PipelineRun %s/%s array indexing params fail validation: failed to validate Pipeline %s/%s's parameters: %s", |
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.
suggest rephrasing to:
PipelineRun \"%s/%s\" failed validation: Failed to validate Pipeline \"%s/%s\"'s parameter which has an invalid index while referring to an array: %s
9097e36
to
dd6e3aa
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
thank you @Yongxuanzhang 👍 /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pritidesai, XinruZhang 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 |
Thanks! I opened an issue to fix comment: #6212 |
/lgtm |
This commit fixes the param array indexing validation error reason and error log, the current reason and error messages are wrongly copied from object validation. This commit fixes this error and adds tests. Signed-off-by: Yongxuan Zhang [email protected]
dd6e3aa
to
5cef1f3
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/lgtm |
Changes
This commit fixes the param array indexing validation error reason and error log, the current reason and error messages are wrongly copied from object validation. This commit fixes this error and adds tests.
/kind bug
Signed-off-by: Yongxuan Zhang [email protected]
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes