diff --git a/scripts/publish-image.sh b/scripts/publish-image.sh index 7b8c408..c85d874 100755 --- a/scripts/publish-image.sh +++ b/scripts/publish-image.sh @@ -23,7 +23,13 @@ fi # An x86 machine builds arm64 under QEMU emulation, which has to be registered # once per boot. Registering needs a privileged container, so say how rather # than doing it unasked. -if [[ "$PLATFORMS" == *linux/arm64* ]] && ! docker buildx inspect | grep -q 'linux/arm64'; then +# +# The platform list is captured, not piped into grep: `grep -q` exits on the +# first match, buildx then dies of SIGPIPE, and under `pipefail` that reads as +# "no arm64" — which had this script refuse to publish while arm64 was +# available the whole time. +platforms=$(docker buildx inspect) +if [[ "$PLATFORMS" == *linux/arm64* ]] && [[ "$platforms" != *linux/arm64* ]]; then echo "This builder cannot build linux/arm64. Register emulation (lasts until the next reboot) with:" >&2 echo " docker run --privileged --rm tonistiigi/binfmt --install arm64" >&2 exit 1