Skip to content

Add OCI source annotation and custom version annotation to images#2111

Open
joebowbeer wants to merge 1 commit into
GoogleContainerTools:mainfrom
joebowbeer:add-oci-annotations-nodejs
Open

Add OCI source annotation and custom version annotation to images#2111
joebowbeer wants to merge 1 commit into
GoogleContainerTools:mainfrom
joebowbeer:add-oci-annotations-nodejs

Conversation

@joebowbeer

@joebowbeer joebowbeer commented Jun 23, 2026

Copy link
Copy Markdown

Adds OCI image annotations to all distroless image types, addressing the version pinning request in #686.

Annotations added:

  • org.opencontainers.image.source - set to the repository URL (from OS_RELEASE["HOME_URL"] in variables.bzl) on all image types: base, cc, static, python3, nodejs, and java
  • com.google.distroless.nodejs.version - the specific Node.js archive version (e.g. 24.18.0), per architecture
  • com.google.distroless.java.version - the specific Temurin JRE/JDK version installed

The org.opencontainers.image.source annotation is the most essential annotation to add, per

https://snyk.io/blog/how-and-when-to-use-docker-labels-oci-container-annotations/

The Java and NodeJS images are the only images where it makes sense to add a separate version annotation, and for these I think a custom namespace (com.google.distroless) is needed.

More annotations can be added later as needed.

Implementation notes for NodeJS versioning:

Rather than adding a static NODEJS_VERSIONS dict to config.bzl, a new node_versions_repo repository rule is generated by the existing node module extension in node.bzl. This creates an @node_versions//:versions.bzl file that nodejs.bzl loads at analysis time - the same pattern used for Debian package versions. The update_node_archives.js script is updated to regenerate the node_versions_repo() call alongside the existing node_archive() calls, so there is no version data to keep in sync manually.

Closes #686

Loading
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.

Version pinning support?

2 participants