From 2bbd219de2e581faf69e2100c77438005fb332d6 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Fri, 6 Sep 2024 14:56:09 +0100 Subject: [PATCH] Add OCI source label to images When building images with ko, add the OCI source label: org.opencontainers.image.source=https://$(params.package) This is generally useful, and in the case of ghcr.io it lets GitHub automatically associated the container image with its source repository. Signed-off-by: Andrea Frittoli --- tekton/publish.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tekton/publish.yaml b/tekton/publish.yaml index 5491a5c8a02..361d1f5de79 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -163,7 +163,11 @@ spec: # Publish images and create release.notags.yaml # This is useful if your container runtime doesn't support the `image-reference:tag@digest` notation # This is currently the case for `cri-o` (and most likely others) - ko resolve --platform=$(params.platforms) --preserve-import-paths -R -f ${PROJECT_ROOT}/config/ > $OUTPUT_RELEASE_DIR/release.notags.yaml + ko resolve \ + --image-label=org.opencontainers.image.source=https://$(params.package) \ + --platform=$(params.platforms) \ + --preserve-import-paths \ + -R -f ${PROJECT_ROOT}/config/ > $OUTPUT_RELEASE_DIR/release.notags.yaml # Rewrite "devel" to params.versionTag sed -i -e 's/\(pipeline.tekton.dev\/release\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(app.kubernetes.io\/version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(version\): "devel"/\1: "$(params.versionTag)"/g' ${OUTPUT_RELEASE_DIR}/release.yaml