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

Allow to provide custom OCI annotations #133

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hpedrorodrigues
Copy link

@hpedrorodrigues hpedrorodrigues commented Mar 16, 2024

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

  • apko-publish: this version worked well here (see job, for instance).
example manifest

revision, created, and version are the annotations we are interested in.

♪ 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 <github.com/hpedrorodrigues>",
    "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"
  }
}
  • apko-snapshot: this version is working well here (see job, for instance).
example manifest

revision, created, and version are the annotations we are interested in.

♪ 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 <github.com/hpedrorodrigues>",
    "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.

Comment on lines +133 to +136
source-date-epoch:
description: |
The UNIX timestamp to use as the source date when building an image.
default: ''
Copy link
Author

@hpedrorodrigues hpedrorodrigues Mar 17, 2024

Choose a reason for hiding this comment

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

We allow providing this input to apko-build and apko-publish.
Since I'm also interested in it, I'm taking the opportunity to add it to this action.
Let me know if it makes sense to keep it here.

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.

1 participant