From 93f1894b3b20af04af701f8ca76f2ec0801fbf0e Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 28 May 2021 11:52:28 +0200 Subject: [PATCH 1/5] fix: use new ARM crossbuild docker images --- .ci/packer_cache.sh | 2 ++ dev-tools/mage/crossbuild.go | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index e4248118fae..1627343c612 100755 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -45,6 +45,8 @@ function dockerPullImages() { docker.elastic.co/kibana/kibana:${SNAPSHOT} docker.elastic.co/logstash/logstash:${SNAPSHOT} docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-arm + docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-armhf + docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-armel docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-base-arm-debian9 docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-darwin docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 368bd0a422d..caa55a9bee8 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -197,13 +197,18 @@ func crossBuildImage(platform string) (string, error) { tagSuffix := "main" switch { - case strings.HasPrefix(platform, "darwin"): + case strings.HasPrefix(platform, "darwin/amd64"): tagSuffix = "darwin" - case strings.HasPrefix(platform, "linux/arm"): - tagSuffix = "arm" - if runtime.GOARCH == "arm64" { - tagSuffix = "base-arm-debian9" - } + case strings.HasPrefix(platform, "darwin/arm64"): + tagSuffix = "darwin-arm64" + case strings.HasPrefix(platform, "linux/arm64"): + tagSuffix = "base-arm-debian9" + case strings.HasPrefix(platform, "linux/armv5"): + tagSuffix = "armel" + case strings.HasPrefix(platform, "linux/armv6"): + tagSuffix = "armel" + case strings.HasPrefix(platform, "linux/armv7"): + tagSuffix = "armhf" case strings.HasPrefix(platform, "linux/mips"): tagSuffix = "mips" case strings.HasPrefix(platform, "linux/ppc"): From 7de9f0a1917062b9a0358e2ed89a3f9e86324f5b Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 28 May 2021 12:47:18 +0200 Subject: [PATCH 2/5] fix: enable ARMv7 package --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6ad0ac88133..f3f04d56a1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -352,9 +352,9 @@ def packagingLinux(Map args = [:]) { 'linux/amd64', 'linux/386', 'linux/arm64', + 'linux/armv7', // The platforms above are disabled temporarly as crossbuild images are // not available. See: https://github.com/elastic/golang-crossbuild/issues/71 - //'linux/armv7', //'linux/ppc64le', //'linux/mips64', //'linux/s390x', From eb4c5c8f6b0a5d550d937a85350af63298fdc33b Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 28 May 2021 13:32:57 +0200 Subject: [PATCH 3/5] fix: use base-arm-debian9 only on ARM64 hosts --- dev-tools/mage/crossbuild.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index caa55a9bee8..17dc88fb282 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -202,7 +202,11 @@ func crossBuildImage(platform string) (string, error) { case strings.HasPrefix(platform, "darwin/arm64"): tagSuffix = "darwin-arm64" case strings.HasPrefix(platform, "linux/arm64"): - tagSuffix = "base-arm-debian9" + tagSuffix = "arm" + // when it runs on a ARM64 host/worker. + if runtime.GOARCH == "arm64" { + tagSuffix = "base-arm-debian9" + } case strings.HasPrefix(platform, "linux/armv5"): tagSuffix = "armel" case strings.HasPrefix(platform, "linux/armv6"): From a9e4467d70adb1f737d815b0f46ed0faac39abc6 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 28 May 2021 14:23:23 +0200 Subject: [PATCH 4/5] chore: re-disable amrv7 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f3f04d56a1d..6ad0ac88133 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -352,9 +352,9 @@ def packagingLinux(Map args = [:]) { 'linux/amd64', 'linux/386', 'linux/arm64', - 'linux/armv7', // The platforms above are disabled temporarly as crossbuild images are // not available. See: https://github.com/elastic/golang-crossbuild/issues/71 + //'linux/armv7', //'linux/ppc64le', //'linux/mips64', //'linux/s390x', From 5d3ae5e0ddf22c49e7f9c51c5196b1e6fc7ef6d8 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Mon, 31 May 2021 13:37:37 +0200 Subject: [PATCH 5/5] fix: linting issue --- dev-tools/mage/crossbuild.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 5e875a23228..10d73c3876c 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -197,7 +197,7 @@ func crossBuildImage(platform string) (string, error) { tagSuffix := "main" switch { - case platform == "darwin/amd64": + case platform == "darwin/amd64": tagSuffix = "darwin-debian10" case platform == "darwin/arm64": tagSuffix = "darwin-arm64-debian10"