Skip to content

Commit c66f913

Browse files
Copilotalessfg
andcommitted
Add manifest and index level annotations to multiplatform manifest creation
Co-authored-by: alessfg <[email protected]>
1 parent 9927ced commit c66f913

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/alpine-mainline.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,17 @@ jobs:
294294
type=raw,value=mainline-alpine${{ needs.version.outputs.distro }}-slim
295295
type=raw,value=alpine-slim
296296
type=raw,value=alpine${{ needs.version.outputs.distro }}-slim
297+
env:
298+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
297299

298300
- name: Push slim manifest to external registries
299301
if: ${{ github.event_name != 'pull_request' }}
300302
run: |
301303
TAGS="${{ steps.meta-slim.outputs.tags }}"
304+
ANNOTATIONS=$(echo '${{ steps.meta-slim.outputs.annotations }}' | jq -r 'to_entries | map("--annotation \"" + .key + "=" + .value + "\"") | join(" ")')
302305
for tag in $TAGS; do
303-
echo "Pushing manifest for $tag from local registry"
304-
docker buildx imagetools create -t "$tag" localhost:5000/nginx-unprivileged:alpine-slim
306+
echo "Pushing manifest for $tag from local registry with annotations"
307+
eval "docker buildx imagetools create $ANNOTATIONS -t \"$tag\" localhost:5000/nginx-unprivileged:alpine-slim"
305308
done
306309
307310
- name: Extract metadata for core image
@@ -325,14 +328,17 @@ jobs:
325328
type=raw,value=mainline-alpine${{ needs.version.outputs.distro }}
326329
type=raw,value=alpine
327330
type=raw,value=alpine${{ needs.version.outputs.distro }}
331+
env:
332+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
328333

329334
- name: Push core manifest to external registries
330335
if: ${{ github.event_name != 'pull_request' }}
331336
run: |
332337
TAGS="${{ steps.meta-core.outputs.tags }}"
338+
ANNOTATIONS=$(echo '${{ steps.meta-core.outputs.annotations }}' | jq -r 'to_entries | map("--annotation \"" + .key + "=" + .value + "\"") | join(" ")')
333339
for tag in $TAGS; do
334-
echo "Pushing manifest for $tag from local registry"
335-
docker buildx imagetools create -t "$tag" localhost:5000/nginx-unprivileged:alpine
340+
echo "Pushing manifest for $tag from local registry with annotations"
341+
eval "docker buildx imagetools create $ANNOTATIONS -t \"$tag\" localhost:5000/nginx-unprivileged:alpine"
336342
done
337343
338344
# Docker Hub signing for slim

0 commit comments

Comments
 (0)