Skip to content

Commit

Permalink
Add back requirement names
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Jul 9, 2024
1 parent 14f084b commit 7966be3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions internal/runbits/cves/cves.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewCveReport(prime primeable) *CveReport {
return &CveReport{prime}
}

func (c *CveReport) Report(newBuildPlan *buildplan.BuildPlan, oldBuildPlan *buildplan.BuildPlan) error {
func (c *CveReport) Report(newBuildPlan *buildplan.BuildPlan, oldBuildPlan *buildplan.BuildPlan, names ...string) error {
changeset := newBuildPlan.DiffArtifacts(oldBuildPlan, false)
if c.shouldSkipReporting(changeset) {
logging.Debug("Skipping CVE reporting")
Expand Down Expand Up @@ -71,11 +71,11 @@ func (c *CveReport) Report(newBuildPlan *buildplan.BuildPlan, oldBuildPlan *buil
}
}

names := make([]string, len(ingredients))
for i, ing := range ingredients {
names[i] = ing.Name
if len(names) == 0 {
for _, ing := range ingredients {
names = append(names, ing.Name)
}
}

pg := output.StartSpinner(c.prime.Output(), locale.Tr("progress_cve_search", strings.Join(names, ", ")), constants.TerminalAnimationInterval)

ingredientVulnerabilities, err := model.FetchVulnerabilitiesForIngredients(c.prime.Auth(), ingredients)
Expand Down
3 changes: 2 additions & 1 deletion internal/runbits/requirements/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ func (r *RequirementOperation) ExecuteRequirementOperation(ts *time.Time, requir
dependencies.OutputChangeSummary(r.Output, rtCommit.BuildPlan(), oldBuildPlan)

// Report CVEs
if err := cves.NewCveReport(r.prime).Report(rtCommit.BuildPlan(), oldBuildPlan); err != nil {
names := requirementNames(requirements...)
if err := cves.NewCveReport(r.prime).Report(rtCommit.BuildPlan(), oldBuildPlan, names...); err != nil {
return errs.Wrap(err, "Could not report CVEs")
}

Expand Down

0 comments on commit 7966be3

Please sign in to comment.