Skip to content

Commit

Permalink
Add OCI source label to image
Browse files Browse the repository at this point in the history
WHen building the dashboard image with `ko`, add the OCI source label:

`org.opencontainers.image.source=https://$(params.package)`

This is generally useful, and in the case og ghcr.io it lets GitHub
automatically associate the container image with its source repo.
  • Loading branch information
AlanGreene authored and tekton-robot committed Sep 25, 2024
1 parent 1042e58 commit 061ceca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/installer
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ EXTERNAL_LOGS=""
BASE_RELEASE_URL="https://storage.googleapis.com/tekton-releases/dashboard"

# additional options passed to ko resolve
KO_RESOLVE_OPTIONS=""
KO_RESOLVE_OPTIONS="--image-label=org.opencontainers.image.source=https://github.com/tektoncd/dashboard"
PLATFORM=""

# Display a box banner.
Expand Down Expand Up @@ -445,7 +445,7 @@ case $1 in
shift
;;
'release'|r)
KO_RESOLVE_OPTIONS="--preserve-import-paths"
KO_RESOLVE_OPTIONS="$KO_RESOLVE_OPTIONS --preserve-import-paths"
ACTION="build"
shift
;;
Expand Down
5 changes: 3 additions & 2 deletions tekton/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ spec:
cp ${PROJECT_ROOT}/scripts/installer $OUTPUT_RELEASE_DIR/installer
# build manifests for installer
kustomize build overlays/installer/read-only --load-restrictor LoadRestrictionsNone | ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f - > $OUTPUT_RELEASE_DIR/installer-release.yaml
kustomize build overlays/installer/read-write --load-restrictor LoadRestrictionsNone | ko resolve --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f - > $OUTPUT_RELEASE_DIR/installer-release-full.yaml
KO_RESOLVE_IMAGE_LABEL="--image-label=org.opencontainers.image.source=https://$(params.package)"
kustomize build overlays/installer/read-only --load-restrictor LoadRestrictionsNone | ko resolve ${KO_RESOLVE_IMAGE_LABEL} --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f - > $OUTPUT_RELEASE_DIR/installer-release.yaml
kustomize build overlays/installer/read-write --load-restrictor LoadRestrictionsNone | ko resolve ${KO_RESOLVE_IMAGE_LABEL} --platform=$(params.platforms) --preserve-import-paths -t $(params.versionTag) -f - > $OUTPUT_RELEASE_DIR/installer-release-full.yaml
# build pre configured manifests
./scripts/installer release --debug --platform $(params.platforms) --tag $(params.versionTag) --output $OUTPUT_RELEASE_DIR/release.yaml
Expand Down

0 comments on commit 061ceca

Please sign in to comment.