Skip to content

Commit

Permalink
pkg/manifests.list.preferOCI(): pay attention annotations in indexes
Browse files Browse the repository at this point in the history
Account for the presence of annotations in the OCI version of an index
or list when deciding if the structure should be saved in OCI format.
This requires removing an annotation from the test data so that the
presence of "features" information for one of its instances will be the
deciding factor.

If we don't take those into account, setting annotations in the index
doesn't force the index to be saved in OCI format, even with none of the
indicators present that would force use of the Docker format,
effectively throwing away those annotations.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
  • Loading branch information
nalind committed Jan 24, 2024
1 parent 4b53eca commit fcb6019
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ func (l *list) preferOCI() bool {
if l.oci.Subject != nil {
return true
}
if len(l.oci.Annotations) > 0 {
return true
}
for _, m := range l.oci.Manifests {
if m.ArtifactType != "" {
return true
Expand Down
5 changes: 1 addition & 4 deletions pkg/manifests/testdata/fedora.index.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,5 @@
"size": 529
}
],
"schemaVersion": 2,
"annotations": {
"foo": "bar"
}
"schemaVersion": 2
}

0 comments on commit fcb6019

Please sign in to comment.