diff --git a/.buildkite/auditbeat/auditbeat-pipeline.yml b/.buildkite/auditbeat/auditbeat-pipeline.yml index 47a00b2c96d4..370ca6096bba 100644 --- a/.buildkite/auditbeat/auditbeat-pipeline.yml +++ b/.buildkite/auditbeat/auditbeat-pipeline.yml @@ -454,9 +454,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - set -euo pipefail - cd auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh auditbeat retry: automatic: - limit: 1 @@ -475,9 +473,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - set -euo pipefail - cd auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh auditbeat retry: automatic: - limit: 1 diff --git a/.buildkite/filebeat/filebeat-pipeline.yml b/.buildkite/filebeat/filebeat-pipeline.yml index 92b007cfdf38..7361ad275f47 100644 --- a/.buildkite/filebeat/filebeat-pipeline.yml +++ b/.buildkite/filebeat/filebeat-pipeline.yml @@ -399,8 +399,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd filebeat - mage package + .buildkite/scripts/packaging/packaging.sh filebeat retry: automatic: - limit: 1 @@ -421,8 +420,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd filebeat - mage package + .buildkite/scripts/packaging/packaging.sh filebeat retry: automatic: - limit: 1 diff --git a/.buildkite/heartbeat/heartbeat-pipeline.yml b/.buildkite/heartbeat/heartbeat-pipeline.yml index 13b0c8035b4f..7d07f804f2e1 100644 --- a/.buildkite/heartbeat/heartbeat-pipeline.yml +++ b/.buildkite/heartbeat/heartbeat-pipeline.yml @@ -343,8 +343,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh heartbeat retry: automatic: - limit: 1 @@ -363,8 +362,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh heartbeat retry: automatic: - limit: 1 diff --git a/.buildkite/metricbeat/pipeline.yml b/.buildkite/metricbeat/pipeline.yml index 674e55c5207f..7082869ba665 100644 --- a/.buildkite/metricbeat/pipeline.yml +++ b/.buildkite/metricbeat/pipeline.yml @@ -399,8 +399,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh metricbeat retry: automatic: - limit: 1 @@ -421,8 +420,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh metricbeat retry: automatic: - limit: 1 diff --git a/.buildkite/packetbeat/pipeline.packetbeat.yml b/.buildkite/packetbeat/pipeline.packetbeat.yml index 31cdecd4ae01..d0b03bd9388e 100644 --- a/.buildkite/packetbeat/pipeline.packetbeat.yml +++ b/.buildkite/packetbeat/pipeline.packetbeat.yml @@ -366,8 +366,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh packetbeat retry: automatic: - limit: 1 @@ -388,8 +387,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh packetbeat retry: automatic: - limit: 1 diff --git a/.buildkite/scripts/packaging/packaging.sh b/.buildkite/scripts/packaging/packaging.sh new file mode 100755 index 000000000000..43d3ae19bfa5 --- /dev/null +++ b/.buildkite/scripts/packaging/packaging.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# 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."} + +#Use newer multiarch support for packaging +docker run --privileged --rm tonistiigi/binfmt:master --install all + +cd $BEAT_DIR +mage package diff --git a/.buildkite/winlogbeat/pipeline.winlogbeat.yml b/.buildkite/winlogbeat/pipeline.winlogbeat.yml index d8986a72a54e..e205fb9e8354 100644 --- a/.buildkite/winlogbeat/pipeline.winlogbeat.yml +++ b/.buildkite/winlogbeat/pipeline.winlogbeat.yml @@ -209,8 +209,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd winlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh winlogbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml index 708073449ffc..d59c6025a276 100644 --- a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml @@ -70,9 +70,7 @@ steps: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" SNAPSHOT: true command: | - set -euo pipefail - cd x-pack/agentbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/agentbeat artifact_paths: - x-pack/agentbeat/build/distributions/**/* - "x-pack/agentbeat/build/*.xml" diff --git a/.buildkite/x-pack/pipeline.xpack.auditbeat.yml b/.buildkite/x-pack/pipeline.xpack.auditbeat.yml index cca156252436..55b78659bd93 100644 --- a/.buildkite/x-pack/pipeline.xpack.auditbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.auditbeat.yml @@ -374,8 +374,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/auditbeat retry: automatic: - limit: 1 @@ -396,8 +395,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/auditbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml b/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml index 54b3451b23e0..85b8634b90f0 100644 --- a/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml @@ -117,8 +117,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/dockerlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/dockerlogbeat retry: automatic: - limit: 1 @@ -137,8 +136,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/dockerlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/dockerlogbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.filebeat.yml b/.buildkite/x-pack/pipeline.xpack.filebeat.yml index 2dc0c8186543..2ba553199c71 100644 --- a/.buildkite/x-pack/pipeline.xpack.filebeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.filebeat.yml @@ -430,8 +430,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/filebeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/filebeat retry: automatic: - limit: 1 @@ -452,8 +451,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/filebeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/filebeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.heartbeat.yml b/.buildkite/x-pack/pipeline.xpack.heartbeat.yml index 839bfc8a35a4..31b224a0f5ae 100644 --- a/.buildkite/x-pack/pipeline.xpack.heartbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.heartbeat.yml @@ -361,8 +361,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/heartbeat retry: automatic: - limit: 1 @@ -383,8 +382,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/heartbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.metricbeat.yml b/.buildkite/x-pack/pipeline.xpack.metricbeat.yml index a074c681a968..156a3b5a5462 100644 --- a/.buildkite/x-pack/pipeline.xpack.metricbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.metricbeat.yml @@ -408,8 +408,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/metricbeat retry: automatic: - limit: 1 @@ -430,8 +429,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/metricbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml b/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml index c06f473c000c..89021df0e166 100644 --- a/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml @@ -283,8 +283,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/osquerybeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/osquerybeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.packetbeat.yml b/.buildkite/x-pack/pipeline.xpack.packetbeat.yml index 1620bc2320ae..b17749dc4cd6 100644 --- a/.buildkite/x-pack/pipeline.xpack.packetbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.packetbeat.yml @@ -451,8 +451,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/packetbeat retry: automatic: - limit: 1 @@ -473,8 +472,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - cd x-pack/packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/packetbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml b/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml index d0ffd9fa89c9..407b5e297120 100644 --- a/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml @@ -252,8 +252,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" command: | - cd x-pack/winlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/winlogbeat retry: automatic: - limit: 1