Skip to content

feat: add org.opencontainers.image.version label to release images - #1770

Open
0x5t4l1n wants to merge 1 commit into
cloudflare:masterfrom
0x5t4l1n:feat/add-oci-version-label
Open

0x5t4l1n wants to merge 1 commit into
cloudflare:masterfrom
0x5t4l1n:feat/add-oci-version-label

Conversation

@0x5t4l1n

Copy link
Copy Markdown

Summary

Closes #1682.

Adds the standard OCI org.opencontainers.image.version annotation to all three release Dockerfiles (Dockerfile, Dockerfile.amd64, Dockerfile.arm64).

Update managers and container dashboards (e.g. Watchtower, Renovate, Docksentry) read this label to display the running release and to show a meaningful v_old → v_new diff when an update is available. Without it, cloudflared surfaces only as an opaque image hash + build date.

Change

A VERSION build-arg (defaulting to dev) is declared in the final stage of each Dockerfile and emitted as the OCI version label:

ARG VERSION=dev
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
LABEL org.opencontainers.image.version="${VERSION}"

Existing CI that does not supply VERSION gets the dev default; release pipelines should pass the release tag:

docker buildx build --build-arg VERSION=${{ github.ref_name }} ...

The builder stage is unchanged. No other files are modified.

Pass a VERSION build-arg (defaulting to 'dev') through to the final
image stage and emit it as an OCI-standard version label. Update
managers and container dashboards read this label to display the running
release and to show a meaningful 'v_old -> v_new' diff when an update is
available. Without it cloudflared surfaces only as an opaque image hash.

The ARG is declared in the final stage (after the distroless FROM) so
the builder stage remains unaffected. Existing CI that does not supply
VERSION will get the 'dev' default; release pipelines should pass
--build-arg VERSION=${{ github.ref_name }} (or equivalent).

Closes cloudflare#1682
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.

💡Add version to org.opencontainers.image.version label

1 participant