Skip to content

Commit

Permalink
fix: handle BLOW_UNKNOWN error to download DBs (#8060)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen authored Dec 6, 2024
1 parent ffe24e1 commit 51f2123
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 51f2123

Please sign in to comment.