-
Notifications
You must be signed in to change notification settings - Fork 417
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 basic syntactical parsing of CEL filters and expressions. #745
Add basic syntactical parsing of CEL filters and expressions. #745
Conversation
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.
PR looks good to me
Thank you 👍
Few minor comments
for _, v := range i.CEL.Overlays { | ||
_, issues := env.Parse(v.Expression) | ||
if issues != nil && issues.Err() != nil { | ||
return apis.ErrInvalidValue(fmt.Errorf("failed to parse the CEL filter: %s", issues.Err()), "cel.filter") |
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.
return apis.ErrInvalidValue(fmt.Errorf("failed to parse the CEL filter: %s", issues.Err()), "cel.filter") | |
return apis.ErrInvalidValue(fmt.Errorf("failed to parse the CEL overlays: %s", issues.Err()), "cel.overlays") |
bldr.EventListenerTrigger("tt", "v1alpha1", | ||
bldr.EventListenerTriggerBinding("tb", "", "tb", "v1alpha1"), | ||
bldr.EventListenerCELInterceptor("body.value == 'test')"), | ||
))), | ||
}, { |
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 we add a test case for invalid overlays
also
_, issues := env.Parse(i.CEL.Filter) | ||
if issues != nil && issues.Err() != nil { |
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.
_, issues := env.Parse(i.CEL.Filter) | |
if issues != nil && issues.Err() != nil { | |
if_, issues := env.Parse(i.CEL.Filter); issues != nil && issues.Err() != nil { |
_, issues := env.Parse(v.Expression) | ||
if issues != nil && issues.Err() != nil { |
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.
_, issues := env.Parse(v.Expression) | |
if issues != nil && issues.Err() != nil { | |
if _, issues := env.Parse(v.Expression); issues != nil && issues.Err() != nil { |
2a3b374
to
5faaff9
Compare
The following is the coverage report on the affected files.
|
Added the reported github issue :) |
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
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
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: khrm 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
This does basic syntax checking of CEL interceptor Filters and Overlays.
This would fix this https://tektoncd.slack.com/archives/CKUSJ2A5D/p1599486079009700
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.
Release Notes