From 426be579924c609fac57554e38dea724f757ce12 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 | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh index 637d1c503ff7..85bdbbf1f43e 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 d79733f5a092..7a4baa402ce2 100755 --- a/scripts/test_images.sh +++ b/scripts/test_images.sh @@ -83,3 +83,11 @@ fi echo "Succesfully tested etcd local image ${TAG}" +for TARGET_ARCH in "amd64" "arm64" "ppc64le" "s390x"; do + ARCH_TAG=v"${VERSION}"-"${TARGET_ARCH}" + if [ "$(docker inspect --format '{{.Architecture}}' ${REPOSITARY}:${ARCH_TAG})" != "$TARGET_ARCH" ];then + echo "Incorrect docker image architecture" + exit 1 + fi + echo "Correct Architecture ${ARCH_TAG}" +done