diff --git a/.github/workflows/publish-aztec-packages.yml b/.github/workflows/publish-aztec-packages.yml index 0f1549677aa..1cee8c76a1b 100644 --- a/.github/workflows/publish-aztec-packages.yml +++ b/.github/workflows/publish-aztec-packages.yml @@ -120,7 +120,7 @@ jobs: timeout-minutes: 80 run: | sudo shutdown -P 80 - ./bootstrap.sh image-aztec + ./bootstrap.sh image-aztec --check-arch docker tag aztecprotocol/aztec:${{ env.GIT_COMMIT }} aztecprotocol/aztec:${{ env.GIT_COMMIT }}-arm64 docker push aztecprotocol/aztec:${{ env.GIT_COMMIT }}-arm64 build-nargo-x86: diff --git a/bootstrap.sh b/bootstrap.sh index e0e4a070cd2..9e59b1de6f9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -201,9 +201,34 @@ case "$cmd" in ;; "image-aztec") image=aztecprotocol/aztec:$(git rev-parse HEAD) + check_arch=false + + # Check for --check-arch flag in args + for arg in "$@"; do + if [ "$arg" = "--check-arch" ]; then + check_arch=true + break + fi + done + docker pull $image &>/dev/null || true if docker_has_image $image; then - exit + if [ "$check_arch" = true ]; then + # Check we're on the correct architecture + image_arch=$(docker inspect $image --format '{{.Architecture}}') + host_arch=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') + + if [ "$image_arch" != "$host_arch" ]; then + echo "Warning: Image architecture ($image_arch) doesn't match host architecture ($host_arch)" + echo "Rebuilding image for correct architecture..." + else + echo "Image $image already exists and has been downloaded with correct architecture." && exit + fi + else + echo "Image $image already exists and has been downloaded." && exit + fi + else + echo "Image $image does not exist, building..." fi github_group "image-aztec" source $ci3/source_tmp