Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirror: update trivy mimetypes error text for trivy-checks #57

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pkg/libmirror/util/errorutil/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const CustomTrivyMediaTypesWarning = `` +
"TL;DR: You should retry push after allowing some additional types of OCI artifacts in your config.yaml as follows:\n" +
`FEATURE_GENERAL_OCI_SUPPORT: true
ALLOWED_OCI_ARTIFACT_TYPES:
"application/vnd.aquasec.trivy.config.v1+json":
- "application/vnd.aquasec.trivy.db.layer.v1.tar+gzip"
"application/octet-stream":
- "application/deckhouse.io.bdu.layer.v1.tar+gzip"
"application/vnd.oci.empty.v1+json":
- "application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip"`
- "application/vnd.cncf.openpolicyagent.layer.v1.tar+gzip"
"application/vnd.aquasec.trivy.config.v1+json":
- "application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip"
- "application/vnd.aquasec.trivy.db.layer.v1.tar+gzip"`

func IsImageNotFoundError(err error) bool {
if err == nil {
Expand All @@ -55,5 +55,6 @@ func IsTrivyMediaTypeNotAllowedError(err error) bool {
}

errMsg := err.Error()
return strings.Contains(errMsg, "MANIFEST_INVALID") && strings.Contains(errMsg, "vnd.aquasec.trivy")
return strings.Contains(errMsg, "MANIFEST_INVALID") &&
(strings.Contains(errMsg, "vnd.aquasec.trivy") || strings.Contains(errMsg, "application/octet-stream"))
}