From 422b54dc5d15ac19c5389a98ee1981d2b5e36b26 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 28 Feb 2025 12:29:26 +0100 Subject: [PATCH] we don't use qemu on ARM64 --- .buildkite/scripts/packaging/packaging.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.buildkite/scripts/packaging/packaging.sh b/.buildkite/scripts/packaging/packaging.sh index ddf1932847fd..98258068cee1 100755 --- a/.buildkite/scripts/packaging/packaging.sh +++ b/.buildkite/scripts/packaging/packaging.sh @@ -3,21 +3,24 @@ # Centralise the mage package for a given beat in Buildkite. # It enables multi-arch builds to avoid the exec format errors when # attempting to build arm64 inside arm64 workers. +# # For further details, see https://github.com/elastic/elastic-agent/pull/6948 # and https://github.com/elastic/golang-crossbuild/pull/507 # set -ueo pipefail - BEAT_DIR=${1:?-"Error: Beat directory must be specified."} -# NOTE: Pinned to QEMU v8.x since v9.x breaks compilation of amd64 binaries in arm64. -# See: https://gitlab.com/qemu-project/qemu/-/issues/2560 -BINFMT_IMAGE="tonistiigi/binfmt:qemu-v8.1.5" -# Make sure to uninstall first to avoid conflicts -docker run --privileged --rm "$BINFMT_IMAGE" --uninstall qemu-* -docker run --privileged --rm "$BINFMT_IMAGE" --install all +if [[ "$(uname -m)" == "aarch64" || "$(uname -m)" == "arm64" ]]; then + echo "Skipping qemu installation on arm64 worker" +else + BINFMT_IMAGE="tonistiigi/binfmt:qemu-v9.2.2" + + # Make sure to uninstall first to avoid conflicts + docker run --privileged --rm "$BINFMT_IMAGE" --uninstall qemu-* + docker run --privileged --rm "$BINFMT_IMAGE" --install all +fi cd $BEAT_DIR mage package