-
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
Read the Pi hostname from config instead of rule_type #1313
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package eval | |
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/stacklok/mediator/internal/engine/eval/jq" | ||
"github.com/stacklok/mediator/internal/engine/eval/package_intelligence" | ||
|
@@ -49,10 +50,14 @@ func NewRuleEvaluator(rt *pb.RuleType, cli *providers.ProviderBuilder) (engif.Ev | |
case vulncheck.VulncheckEvalType: | ||
return vulncheck.NewVulncheckEvaluator(e.GetVulncheck(), cli) | ||
case package_intelligence.PiEvalType: | ||
if rt.Def.Eval.GetPackageIntelligence() == nil { | ||
pie := e.GetPackageIntelligence() | ||
if pie == nil { | ||
return nil, fmt.Errorf("rule type engine missing package_intelligence configuration") | ||
} | ||
return package_intelligence.NewPackageIntelligenceEvaluator(e.GetPackageIntelligence(), cli) | ||
if pie.GetEndpoint() == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused on how this is getting used -- it looks like we're getting Should this be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, I should have passed in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured there was some aliasing going on, but I played dumb because I suspected the using of aliases was accidental. |
||
pie.Endpoint = os.Getenv("MEDIATOR_UNSTABLE_PACKAGE_INTELLIGENCE_ENDPOINT") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think an env var is okay for now, but it would be nice eventually to have a set of options in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea is actually to move this to be a provider. But yeah, it'll be refactored. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the config was what this PR started with but we had a call today with @JAORMX and decided against it in favour of addressing some of the technical debt in the evaluators first which will allow us to use just provider config instead. |
||
} | ||
return package_intelligence.NewPackageIntelligenceEvaluator(pie, cli) | ||
default: | ||
return nil, fmt.Errorf("unsupported rule type engine: %s", rt.Def.Eval.Type) | ||
} | ||
|
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.
unrelated, but should we rename the evaluator to
trusty
?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.
Probably, yes. You can do it now or in the big rename.
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.
Since we're squashing PRs I would prefer a separate PR - otherwise this PR that adds a single env variable would /also/ rename a bunch of identifiers and it would be too hard to search git history.
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 I was asking explicitly because I think this is too easy to miss in the big rename - I assume that whoever is doing the big rename would be looking for mediator, but not necessarily for
package_intelligence
.