diff --git a/.buildkite/auditbeat/auditbeat-pipeline.yml b/.buildkite/auditbeat/auditbeat-pipeline.yml index bb42dbdb9958..cb61808a5d94 100644 --- a/.buildkite/auditbeat/auditbeat-pipeline.yml +++ b/.buildkite/auditbeat/auditbeat-pipeline.yml @@ -262,8 +262,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh auditbeat retry: automatic: - limit: 1 @@ -282,8 +281,7 @@ steps: PLATFORMS: "linux/arm64" PACKAGES: "docker" command: | - 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 e4a89f541c1f..4dfca856e69c 100644 --- a/.buildkite/filebeat/filebeat-pipeline.yml +++ b/.buildkite/filebeat/filebeat-pipeline.yml @@ -304,8 +304,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd filebeat - mage package + .buildkite/scripts/packaging/packaging.sh filebeat retry: automatic: - limit: 1 @@ -326,8 +325,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 80912e790610..a65e71ed33b2 100644 --- a/.buildkite/heartbeat/heartbeat-pipeline.yml +++ b/.buildkite/heartbeat/heartbeat-pipeline.yml @@ -279,8 +279,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh heartbeat retry: automatic: - limit: 1 @@ -299,8 +298,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 a8854bf84389..420503ffb0e9 100644 --- a/.buildkite/metricbeat/pipeline.yml +++ b/.buildkite/metricbeat/pipeline.yml @@ -271,8 +271,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh metricbeat retry: automatic: - limit: 1 @@ -293,8 +292,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 7d065987fae1..c0514061a217 100644 --- a/.buildkite/packetbeat/pipeline.packetbeat.yml +++ b/.buildkite/packetbeat/pipeline.packetbeat.yml @@ -219,8 +219,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh packetbeat retry: automatic: - limit: 1 @@ -241,8 +240,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 1496b49d3a2b..153862821bf8 100644 --- a/.buildkite/winlogbeat/pipeline.winlogbeat.yml +++ b/.buildkite/winlogbeat/pipeline.winlogbeat.yml @@ -188,8 +188,7 @@ steps: env: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" command: | - cd winlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh winlogbeat retry: automatic: - limit: 1 diff --git a/.buildkite/x-pack/pipeline.xpack.auditbeat.yml b/.buildkite/x-pack/pipeline.xpack.auditbeat.yml index 7011c634394e..12dfa97059ba 100644 --- a/.buildkite/x-pack/pipeline.xpack.auditbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.auditbeat.yml @@ -227,8 +227,7 @@ steps: - label: ":ubuntu: x-pack/auditbeat: Packaging Linux" key: "packaging-linux" command: | - cd x-pack/auditbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/auditbeat retry: automatic: - limit: 1 @@ -248,8 +247,7 @@ steps: - label: ":ubuntu: x-pack/auditbeat: Packaging Linux arm64" key: "packaging-arm" 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 a04971cc3971..7d61b730fd28 100644 --- a/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml @@ -118,8 +118,7 @@ steps: PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" SNAPSHOT: true command: | - cd x-pack/dockerlogbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/dockerlogbeat retry: automatic: - limit: 1 @@ -139,8 +138,7 @@ steps: PACKAGES: "docker" SNAPSHOT: true 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 4bc1d06cccdd..a97c22261791 100644 --- a/.buildkite/x-pack/pipeline.xpack.filebeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.filebeat.yml @@ -310,8 +310,7 @@ steps: - label: ":ubuntu: x-pack/filebeat: Packaging Linux" key: "packaging-linux" command: | - cd x-pack/filebeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/filebeat retry: automatic: - limit: 1 @@ -331,8 +330,7 @@ steps: - label: ":ubuntu: x-pack/filebeat: Packaging arm64" key: "packaging-arm" 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 a160622bef7b..1addc844d6af 100644 --- a/.buildkite/x-pack/pipeline.xpack.heartbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.heartbeat.yml @@ -241,8 +241,7 @@ steps: - label: ":ubuntu: x-pack/heartbeat: Packaging Linux" key: "packaging-linux" command: | - cd x-pack/heartbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/heartbeat retry: automatic: - limit: 1 @@ -262,8 +261,7 @@ steps: - label: ":ubuntu: x-pack/heartbeat: Packaging Linux arm64" key: "packaging-arm" 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 8489a2ce8729..26e12f34065f 100644 --- a/.buildkite/x-pack/pipeline.xpack.metricbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.metricbeat.yml @@ -270,8 +270,7 @@ steps: - label: ":ubuntu: x-pack/metricbeat: Packaging Linux" key: "packaging-linux" command: | - cd x-pack/metricbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/metricbeat retry: automatic: - limit: 1 @@ -291,8 +290,7 @@ steps: - label: ":ubuntu: x-pack/metricbeat: Packaging arm64" key: "packaging-arm" 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 fa643637a545..256c02023e21 100644 --- a/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.osquerybeat.yml @@ -214,8 +214,7 @@ steps: - label: ":ubuntu: x-pack/osquerybeat: Packaging Linux" key: "packaging-linux" 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 5f129b079a52..392625a051df 100644 --- a/.buildkite/x-pack/pipeline.xpack.packetbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.packetbeat.yml @@ -217,8 +217,7 @@ steps: - label: ":ubuntu: x-pack/packetbeat Packaging Linux" key: "packaging-linux" command: | - cd x-pack/packetbeat - mage package + .buildkite/scripts/packaging/packaging.sh x-pack/packetbeat retry: automatic: - limit: 1 @@ -238,8 +237,7 @@ steps: - label: ":ubuntu: x-pack/packetbeat Packaging Linux arm64" key: "packaging-arm" 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 3e4494c5e196..f247e6bd5010 100644 --- a/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.winlogbeat.yml @@ -182,7 +182,10 @@ steps: steps: - label: ":ubuntu: x-pack/winlogbeat Packaging Linux" key: "packaging-linux" - command: "cd x-pack/winlogbeat && mage package" + env: + PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" + command: | + .buildkite/scripts/packaging/packaging.sh x-pack/winlogbeat retry: automatic: - limit: 1 @@ -193,8 +196,6 @@ steps: machineType: "${GCP_HI_PERF_MACHINE_TYPE}" disk_size: 100 disk_type: "pd-ssd" - env: - PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64" notify: - github_commit_status: context: "x-pack/winlogbeat Packaging Linux"