From fb7a7f674682f4d3db51fc7c0dd6cfb9e99aefc0 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 23 Jan 2024 15:48:35 -0500 Subject: [PATCH] pkg/manifests.list.preferOCI() learn about some new OCI fields The OCI image index structure has grown a few new fields since the last time we looked, so we should be paying attention to whether any of them are being used when deciding if we need to use the OCI format instead of the Docker format. The Docker format also grew a "URLs" field, so we can't use its mere presence as a heuristic any more. Signed-off-by: Nalin Dahyabhai --- pkg/manifests/manifests.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/manifests/manifests.go b/pkg/manifests/manifests.go index 8296faa82..26ecd091f 100644 --- a/pkg/manifests/manifests.go +++ b/pkg/manifests/manifests.go @@ -421,13 +421,22 @@ func FromBlob(manifestBytes []byte) (List, error) { func (l *list) preferOCI() bool { // If we have any data that's only in the OCI format, use that. + if l.oci.ArtifactType != "" { + return true + } + if l.oci.Subject != nil { + return true + } for _, m := range l.oci.Manifests { - if len(m.URLs) > 0 { + if m.ArtifactType != "" { return true } if len(m.Annotations) > 0 { return true } + if len(m.Data) > 0 { + return true + } } // If we have any data that's only in the Docker format, use that. for _, m := range l.docker.Manifests {