mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-21 17:55:30 +01:00
No sbom_overview when sbom is deleted (#20533)
fixes #20529 Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
parent
30767f6612
commit
74f4a358f8
@ -97,6 +97,10 @@ func (assembler *ScanReportAssembler) Assemble(ctx context.Context) error {
|
||||
log.Warningf("get scan summary of artifact %s@%s for %s failed, error:%v", artifact.RepositoryName, artifact.Digest, v1.MimeTypeSBOMReport, err)
|
||||
}
|
||||
if len(overview) == 0 {
|
||||
// only fetch the sbom overview from execution when the overview is empty and the artifact has child references ( image index, cnab etc)
|
||||
if len(artifact.References) == 0 {
|
||||
continue
|
||||
}
|
||||
log.Warningf("overview is empty, retrieve sbom status from execution")
|
||||
// Get latest execution with digest, repository, and scan type is sbom, the status is the scan status
|
||||
query := q.New(
|
||||
|
@ -128,7 +128,7 @@ func (suite *VulAssemblerTestSuite) TestAssembleSBOMOverviewImageIndex() {
|
||||
var artifact model.Artifact
|
||||
err := assembler.WithArtifacts(&artifact).Assemble(context.TODO())
|
||||
suite.Nil(err)
|
||||
suite.Equal(artifact.SBOMOverView["scan_status"], "Error")
|
||||
suite.Nil(artifact.SBOMOverView["scan_status"])
|
||||
|
||||
mock.OnAnything(exeMgr, "List").Return(nil, nil).Once()
|
||||
var artifact2 model.Artifact
|
||||
|
Loading…
Reference in New Issue
Block a user