From 7ac443f728989a84bde49d4c1273280180d1a1ff Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Thu, 9 Feb 2023 18:38:07 +0800 Subject: [PATCH] Fixes: #15266 All docker images of Architecture show amd64 Signed-off-by: zhangguanzhang --- scripts/build-docker.sh | 6 ++++-- scripts/test_images.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh index 637d1c503ff..85bdbbf1f43 100755 --- a/scripts/build-docker.sh +++ b/scripts/build-docker.sh @@ -41,8 +41,10 @@ cp "${BINARYDIR}"/etcd "${BINARYDIR}"/etcdctl "${BINARYDIR}"/etcdutl "${IMAGEDIR cat ./"${DOCKERFILE}" > "${IMAGEDIR}"/Dockerfile if [ -z "${TAG:-}" ]; then - docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}" - docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}" + # Fix incorrect image "Architecture" using buildkit + # From https://stackoverflow.com/q/72144329/ + DOCKER_BUILDKIT=1 docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}" + DOCKER_BUILDKIT=1 docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}" else docker build -t "${TAG}:${VERSION}" "${IMAGEDIR}" fi diff --git a/scripts/test_images.sh b/scripts/test_images.sh index d79733f5a09..04d5e1e1e20 100755 --- a/scripts/test_images.sh +++ b/scripts/test_images.sh @@ -83,3 +83,12 @@ fi echo "Succesfully tested etcd local image ${TAG}" +for TARGET_ARCH in "amd64" "arm64" "ppc64le" "s390x"; do + ARCH_TAG=v"${VERSION}"-"${TARGET_ARCH}" + IMG_ARCH=$(docker inspect --format '{{.Architecture}}' "${REPOSITARY}:${ARCH_TAG}") + if [ "${IMG_ARCH}" != "$TARGET_ARCH" ];then + echo "Incorrect docker image architecture" + exit 1 + fi + echo "Correct Architecture ${ARCH_TAG}" +done