Skip to content

Commit 6db8bbf

Browse files
committed
Fix the sbom status
1 parent f2f8f09 commit 6db8bbf

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

cmd/scan.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,10 @@ func isScanReleaseFailed(scan *client.ScanDetail, release *client.ReleaseStatus,
14971497
failedScans["MAST"] = scan.ID
14981498
}
14991499

1500+
if release.SBOM.Status == statusFail {
1501+
failedScans["SBOM"] = ""
1502+
}
1503+
15001504
if release.INFRA.Status == statusFail {
15011505
failedScans["INFRA"] = scan.ID
15021506
}
@@ -1522,12 +1526,16 @@ func isScanReleaseFailed(scan *client.ScanDetail, release *client.ReleaseStatus,
15221526
fmt.Println()
15231527
fmt.Println("-----------------------------------------------------------------")
15241528
fmt.Printf("[!] project does not pass release criteria due to [%s] failure\n", toolType)
1525-
scan, err := c.FindScanByID(scanID)
1526-
if err != nil {
1527-
return fmt.Errorf("failed to fetch scan [%s] summary: %w", scanID, err)
1528-
}
15291529

1530-
printScanSummary(scan)
1530+
// SBOM doesn't have a scan_id, skip fetching scan details
1531+
if scanID != "" {
1532+
scan, err := c.FindScanByID(scanID)
1533+
if err != nil {
1534+
return fmt.Errorf("failed to fetch scan [%s] summary: %w", scanID, err)
1535+
}
1536+
1537+
printScanSummary(scan)
1538+
}
15311539
fmt.Println("-----------------------------------------------------------------")
15321540
}
15331541
}

0 commit comments

Comments
 (0)