Skip to content

Commit

Permalink
pkg/manifests.list.preferOCI() learn about some new OCI fields
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nalind authored and kwilczynski committed Mar 13, 2024
1 parent 93d72c7 commit 0d35c65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,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 {
Expand Down

0 comments on commit 0d35c65

Please sign in to comment.