-
Notifications
You must be signed in to change notification settings - Fork 42
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 eval details template for deny-by-default rule. #4647
Conversation
530b44f
to
d4d4b8e
Compare
@@ -177,7 +177,7 @@ func (r *RuleTypeEngine) Eval( | |||
|
|||
// Process evaluation | |||
logger.Info().Msg("entity evaluation - evaluation started") | |||
err := r.ruleEvaluator.Eval(ctx, params.GetRule().Def, result) | |||
err := r.ruleEvaluator.Eval(ctx, params.GetRule().Def, inf.Entity, result) |
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 could turn this into the same pattern as the one used here to limit the changes across the code base, let me know what you folks prefer.
d4d4b8e
to
db05cd9
Compare
This change adds a template used to produce evaluation details for the `rego/deny-by-default` evaluation engine. This template allows the user defining the rule to output a `message` variable with a custom message to show when the evaluation fails. Fixes stacklok/minder-stories#42
db05cd9
to
e741b32
Compare
@@ -0,0 +1 @@ | |||
Evaluation {{ .status }}: {{ .message }}{{ with .entityName }} for entity {{ . }}{{ end }} |
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.
Based on https://github.com/stacklok/minder-stories/issues/42#issuecomment-2394190172 should this be Evaluation {{ .status }}: {{ .message }}{{ with .entityName }} for {{ . }}{{ end }}
?
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.
Also, should we remove the Evaluation {{ .status }}:
prefix? I think all the places that would use this already show the status separately from the details.
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.
Yes, I might have prematurely optimized for the other cases (non failed
ones).
I'll remove that.
Summary
This change adds a template used to produce evaluation details for the
rego/deny-by-default
evaluation engine.This template allows the user defining the rule to output a
message
variable with a custom message to show when the evaluation fails.Fixes stacklok/minder-stories#42
Change Type
Testing
Unit and manual tested.
Review Checklist: