Skip to content

Commit

Permalink
we don't use qemu on ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Mar 3, 2025
1 parent 339466d commit 422b54d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .buildkite/scripts/packaging/packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 422b54d

Please sign in to comment.