chainguard-images / actions

GitHub actions for the chainguard-images
Apache License 2.0
16 stars 21 forks source link

Allow to provide custom OCI annotations #133

Open hpedrorodrigues opened 3 months ago

hpedrorodrigues commented 3 months ago

Hey 👋🏻

Description

This pull request basically allows to provide custom OCI annotations to be added to the final artifacts (using either apko-publish or apko-snapshot actions).

If we want to add annotations without these changes, we likely need to use a separate action to update the config file before calling apko-publish (or apko-snapshot) (see example) or implement some other workaround. The main idea here is to make this process easier.

Basic Testing

example manifest `revision`, `created`, and `version` are the annotations we are interested in. ```bash ♪ crane manifest ghcr.io/hpedrorodrigues/envsubst:1.30.1 | jq { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 916, "digest": "sha256:661b18f68e995e9171e1a60e0836a9ebbcc0344f299057e80c29b8efc7520df3", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 916, "digest": "sha256:55deeb9f2a1193a5caa3c3d254f13e93e535974a50af5bc1e04f66fb1ace4a1b", "platform": { "architecture": "arm64", "os": "linux" } } ], "annotations": { "org.opencontainers.image.authors": "Pedro Rodrigues ", "org.opencontainers.image.created": "2024-03-16T04:14:31", "org.opencontainers.image.description": "Simple image wrapping envsubst (gettext)", "org.opencontainers.image.revision": "06e805cea68b238bde5c297ecaf4436219b80d2c", "org.opencontainers.image.source": "https://github.com/hpedrorodrigues/images/tree/main/envsubst", "org.opencontainers.image.title": "envsubst", "org.opencontainers.image.version": "1.30.1" } } ```
example manifest `revision`, `created`, and `version` are the annotations we are interested in. ```bash ♪ crane manifest ghcr.io/hpedrorodrigues/envsubst:1.47.1 | jq { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 916, "digest": "sha256:204151eafbcf0ef6ed1b9b06638f58c82d6567b65f04f947f6eb7f4d3e1f074e", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 916, "digest": "sha256:7346a405e766c3ba82cbf53e4635b4696c5643da3bc2c4529a1fda33e2f8e61a", "platform": { "architecture": "arm64", "os": "linux" } } ], "annotations": { "org.opencontainers.image.authors": "Pedro Rodrigues ", "org.opencontainers.image.created": "2024-03-17T19:44:53", "org.opencontainers.image.description": "Simple image wrapping envsubst (gettext)", "org.opencontainers.image.revision": "d9d40e00117119c1990afdadfe47fa2dd88f1756", "org.opencontainers.image.source": "https://github.com/hpedrorodrigues/images/tree/main/envsubst", "org.opencontainers.image.title": "envsubst", "org.opencontainers.image.version": "1.47.1" } } ```

Let me know if these changes make sense for this project or if you have any concerns.