nlewo/nix2container

Support annotations

aaronmondal opened this issue · 1 comments

Annotations in the OCI spec may be used to add additional information to an image: https://github.com/opencontainers/image-spec/blob/main/annotations.md

We recently migrated from the builtin dockerTools to nix2container (TraceMachina/nativelink@1a43ef9). Just now did I notice that our annotations are no longer visible in the github actions tab.

Before migration:

https://github.com/TraceMachina/nativelink/pkgs/container/nativelink/192735920?tag=2bqf910c8d2g5b0l4gmrifq1xbvxfdmg

After migration:

https://github.com/TraceMachina/nativelink/pkgs/container/nativelink/193042543?tag=symgcw9plncfbp18vizjhzl8nfknbkgr

It looks like the config.Labels section behaves slightly differently between the two.

dockerTools adds the labels to the manifest, visible with docker manifest inspect someimage, while nix2container adds it to the Config section in the output of docker image inspect someimage.

AFAIU the behavior of dockerTools is actually incorrect as the annotations shouldn't live in config but in a separate annotations field instead: https://github.com/opencontainers/image-spec/blob/main/manifest.md#image-manifest-property-descriptions

Would it be possible/sensible to add an annotations field to buildImage and friends?

Hello @aaronmondal ,

Would it be possible/sensible to add an annotations field to buildImage and friends?

Such kind of contributions would be welcomed (i've not planned to implement it soon).