Skip to content

Commit

Permalink
fix: handle BLOW_UNKNOWN error to download DBs [backport: release/v…
Browse files Browse the repository at this point in the history
…0.58] (#8121)

Co-authored-by: DmitriyLewen <[email protected]>
  • Loading branch information
aqua-bot and DmitriyLewen authored Dec 18, 2024
1 parent 4278a09 commit 9a56e7c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/oci/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ func shouldTryOtherRepo(err error) bool {
}
}

// try the following artifact only if a temporary error occurs
return terr.Temporary()
// try the following artifact if a temporary error occurs
if terr.Temporary() {
return true
}

// `GCR` periodically returns `BLOB_UNKNOWN` error.
// cf. https://github.com/aquasecurity/trivy/discussions/8020
// In this case we need to check other repositories.
for _, e := range terr.Errors {
if e.Code == transport.BlobUnknownErrorCode {
return true
}
}

return false
}

0 comments on commit 9a56e7c

Please sign in to comment.