Skip to content

Commit 854f882

Browse files
authored
Merge pull request Stack-Cairn#241 from Stack-Cairn/fix/release-verify-digest-conflict
ci: 修复发布 workflow 按架构校验步骤的 digest 冲突
2 parents 4d07fec + 32ee0db commit 854f882

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/gateway-docker.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,22 @@ jobs:
6868
- name: Verify per-arch binaries
6969
run: |
7070
set -euo pipefail
71-
image="$(echo "$IMAGE_NAME" | tr '[:upper:]' '[:lower:]')@${{ steps.push.outputs.digest }}"
71+
repo="$(echo "$IMAGE_NAME" | tr '[:upper:]' '[:lower:]')"
72+
index="$repo@${{ steps.push.outputs.digest }}"
7273
for arch in amd64 arm64; do
7374
case "$arch" in
7475
amd64) want="x86-64" ;;
7576
arm64) want="aarch64" ;;
7677
esac
77-
docker pull --platform "linux/$arch" "$image" >/dev/null
78+
# Pull each variant by its own manifest digest. Pulling the shared
79+
# index digest with --platform binds repo@digest to one platform,
80+
# so the second arch fails with "cannot overwrite digest".
81+
digest="$(docker buildx imagetools inspect --raw "$index" \
82+
| jq -r --arg arch "$arch" '.manifests[] | select(.platform.os == "linux" and .platform.architecture == $arch) | .digest')"
83+
test -n "$digest" || { echo "::error::pushed index has no linux/$arch manifest"; exit 1; }
84+
docker pull "$repo@$digest" >/dev/null
7885
docker rm -f "verify-$arch" >/dev/null 2>&1 || true
79-
docker create --platform "linux/$arch" --name "verify-$arch" "$image" >/dev/null
86+
docker create --name "verify-$arch" "$repo@$digest" >/dev/null
8087
docker cp "verify-$arch:/usr/local/bin/liveagent-gateway" "/tmp/gateway-$arch"
8188
docker rm -f "verify-$arch" >/dev/null
8289
info="$(file -b "/tmp/gateway-$arch")"

0 commit comments

Comments
 (0)