Skip to content

Commit fede0f9

Browse files
committed
fix: create separate manifests for each registry
The previous approach tried to create a single manifest referencing digests from multiple registries, which doesn't work. Each registry needs its own manifest list created from its own digests. Changes: - Loop through each registry (docker.io and ghcr.io) separately - Create manifest list for each registry with registry-specific digests - Apply appropriate tags to each registry's manifest
1 parent f85ec56 commit fede0f9

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/build-cli-docker.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,28 @@ jobs:
161161
image_tags=$(printf '%s' "$DOCKER_METADATA_OUTPUT_JSON" | jq -cr '.tags | map("-t " + .) | join(" ")')
162162
echo "Creating manifest list with tags: $image_tags"
163163
164-
# Extract unique image names (without tags) to build digest references
165-
image_names=$(printf '%s' "$DOCKER_METADATA_OUTPUT_JSON" | jq -cr '.tags | map(split(":")[0]) | unique | join(" ")')
166-
echo "Image names: $image_names"
164+
# We need to create separate manifests for each registry
165+
# because the digests are registry-specific
167166
168-
# Build digest references for all images
169-
digest_refs=""
170-
for image_name in $image_names; do
167+
# For each registry, create manifest with its digests
168+
for registry in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
169+
echo "Processing registry: $registry"
170+
171+
# Get tags for this registry
172+
registry_tags=$(printf '%s' "$DOCKER_METADATA_OUTPUT_JSON" | jq -cr --arg registry "$registry" '.tags | map(select(startswith($registry))) | map("-t " + .) | join(" ")')
173+
174+
# Build digest references for this registry
175+
digest_refs=""
171176
for digest_file in *; do
172-
digest_refs="$digest_refs ${image_name}@sha256:${digest_file}"
177+
digest_refs="$digest_refs ${registry}@sha256:${digest_file}"
173178
done
174-
done
175-
echo "Digest references: $digest_refs"
176179
177-
echo "Creating manifest using buildx..."
178-
docker buildx imagetools create $image_tags $digest_refs
180+
echo "Tags for $registry: $registry_tags"
181+
echo "Digest refs: $digest_refs"
182+
183+
# Create and push manifest for this registry
184+
docker buildx imagetools create $registry_tags $digest_refs
185+
done
179186
180187
# Inspect the first tag for verification
181188
first_tag=$(printf '%s' "$DOCKER_METADATA_OUTPUT_JSON" | jq -cr '.tags[0]')

0 commit comments

Comments
 (0)