Skip to content

Commit

Permalink
Change the log message when PostScan failed.
Browse files Browse the repository at this point in the history
  fixes #20573
  remove s from additions/sboms in the link

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
  • Loading branch information
stonezdj committed Jul 4, 2024
1 parent cc1acc3 commit bfb5af8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controller/artifact/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (artifact *Artifact) SetAdditionLink(addition, version string) {
artifact.AdditionLinks[addition] = &AdditionLink{HREF: href, Absolute: false}
}

// SetSBOMAdditionLink set the link of SBOM addition
func (artifact *Artifact) SetSBOMAdditionLink(sbomDgst string, version string) {
if artifact.AdditionLinks == nil {
artifact.AdditionLinks = make(map[string]*AdditionLink)
Expand All @@ -88,7 +89,7 @@ func (artifact *Artifact) SetSBOMAdditionLink(sbomDgst string, version string) {
projectName, repo := utils.ParseRepository(artifact.RepositoryName)
// encode slash as %252F
repo = repository.Encode(repo)
href := fmt.Sprintf("/api/%s/projects/%s/repositories/%s/artifacts/%s/additions/%s", version, projectName, repo, sbomDgst, addition)
href := fmt.Sprintf("/api/%s/projects/%s/repositories/%s/artifacts/%s/additions/sbom", version, projectName, repo, sbomDgst)

Check warning on line 92 in src/controller/artifact/model.go

View check run for this annotation

Codecov / codecov/patch

src/controller/artifact/model.go#L92

Added line #L92 was not covered by tests

artifact.AdditionLinks[addition] = &AdditionLink{HREF: href, Absolute: false}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/scan/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (j *Job) Run(ctx job.Context, params job.Parameters) error {

reportData, err := handler.PostScan(ctx, req, rp, rawReports[i], startTime, robotAccount)
if err != nil {
myLogger.Errorf("Failed to convert vulnerability data to new schema for report %s, error %v", rp.UUID, err)
myLogger.Errorf("handler failed at PostScan, report %s, error %v", rp.UUID, err)

Check warning on line 307 in src/pkg/scan/job.go

View check run for this annotation

Codecov / codecov/patch

src/pkg/scan/job.go#L307

Added line #L307 was not covered by tests
return err
}

Expand Down

0 comments on commit bfb5af8

Please # to comment.