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

image build: add annotations in OCI image #2522

Merged
merged 2 commits into from
Feb 28, 2024
Merged

image build: add annotations in OCI image #2522

merged 2 commits into from
Feb 28, 2024

Conversation

alban
Copy link
Member

@alban alban commented Feb 21, 2024

OCI images can have annotations at different levels:

  • index
  • manifest
  • config
  • layer

This patch adds annotations in the index, manifest and config levels.

artifacthub reads annotations at the manifest level. The 3 required annotations from artifacthub are defined:

  • io.artifacthub.package.readme-url
  • org.opencontainers.image.created
  • org.opencontainers.image.description

Users can add custom images with the annotations field in gadget.yaml.

#2175

- layer

Inspektor Gadget adds the following annotations at the manifest and config levels:
- `io.artifacthub.package.readme-url`: defined by [ArtifactHUB](https://artifacthub.io/docs/topics/repositories/container-images/#image-metadata)
Copy link
Member Author

@alban alban Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the discussion on artifacthub/hub#3665 (#2175):
New kinds of artifacts are encouraged to use the file artifacthub-pkg.yml file. So gadget authors would publish their gadgets on Artifact Hub by adding this file in their git repository. Artifact Hub would not fetch the annotations from the OCI image.

So I will remove this artifacthub annotation for now.

Note that users can always add custom OCI annotations in the annotations field of gadget.yaml.

Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't gone deep into the details but LGTM from code inspection.

pkg/oci/build.go Outdated Show resolved Hide resolved
OCI images can have annotations at different levels:
- index
- manifest
- config
- layer

This patch adds annotations in the index, manifest and config levels.

The following annotations are automatically defined:
- org.opencontainers.image.title
- org.opencontainers.image.description
- org.opencontainers.image.created
- org.opencontainers.image.url
- org.opencontainers.image.documentation
- org.opencontainers.image.source

Users can add custom images with the annotations field in gadget.yaml.

Signed-off-by: Alban Crequy <albancrequy@linux.microsoft.com>
Signed-off-by: Alban Crequy <albancrequy@linux.microsoft.com>
@alban alban merged commit 6cfa092 into main Feb 28, 2024
61 checks passed
@alban alban deleted the alban_annotations branch February 28, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants