From 3a2a016f8f27758c7dd7cd7579dd28358d72e6b9 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 5 Feb 2021 10:44:23 +0000 Subject: [PATCH 1/8] Bump golang-crossbuild version (from debian7 -> debian8, and debian8 -> debian9) --- dev-tools/mage/crossbuild.go | 4 ++-- journalbeat/magefile.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 4340c7fdb4ea..a9bb76d6a133 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -193,8 +193,8 @@ func crossBuildImage(platform string) (string, error) { tagSuffix = "s390x" case strings.HasPrefix(platform, "linux"): // Use an older version of libc to gain greater OS compatibility. - // Debian 7 uses glibc 2.13. - tagSuffix = "main-debian7" + // Debian 8 uses glibc 2.19. + tagSuffix = "debian8" } goVersion, err := GoVersion() diff --git a/journalbeat/magefile.go b/journalbeat/magefile.go index 0644ce7d275f..e1e7408b0f71 100644 --- a/journalbeat/magefile.go +++ b/journalbeat/magefile.go @@ -145,7 +145,7 @@ func selectImage(platform string) (string, error) { case platform == "linux/s390x": tagSuffix = "s390x" case strings.HasPrefix(platform, "linux"): - tagSuffix = "main-debian8" + tagSuffix = "debian9" } goVersion, err := devtools.GoVersion() From 05b87565f80c060e94c263dd0db771cb2cc9c82f Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 5 Feb 2021 12:20:26 +0000 Subject: [PATCH 2/8] use main-debian8 docker image --- 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 a9bb76d6a133..13b280bd7e5a 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -194,7 +194,7 @@ func crossBuildImage(platform string) (string, error) { case strings.HasPrefix(platform, "linux"): // Use an older version of libc to gain greater OS compatibility. // Debian 8 uses glibc 2.19. - tagSuffix = "debian8" + tagSuffix = "main-debian8" } goVersion, err := GoVersion() From 9f34ddbf503fae9ff5e9392e8c54658448ef1444 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 5 Feb 2021 13:49:53 +0000 Subject: [PATCH 3/8] use main-debian9 docker image --- journalbeat/magefile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journalbeat/magefile.go b/journalbeat/magefile.go index e1e7408b0f71..9db865ac5307 100644 --- a/journalbeat/magefile.go +++ b/journalbeat/magefile.go @@ -145,7 +145,7 @@ func selectImage(platform string) (string, error) { case platform == "linux/s390x": tagSuffix = "s390x" case strings.HasPrefix(platform, "linux"): - tagSuffix = "debian9" + tagSuffix = "main-debian9" } goVersion, err := devtools.GoVersion() From f71dddc184c8890927525eafeffa8d67c5d7938d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Apr 2021 10:56:10 +0100 Subject: [PATCH 4/8] packer-cache update --- .ci/packer_cache.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index c0f24c41c1da..3ee1ad9b0878 100644 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -64,6 +64,7 @@ docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-darwin docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-debian7 docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-debian8 +docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-debian9 docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-mips docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-ppc docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-s390x From e0f189cab80e47a5382ced6bcfe51f6f11df3ead Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 13 Jul 2021 12:10:58 +0100 Subject: [PATCH 5/8] Let's normalise the dependencies --- 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 1abd73e8f1bc..dcce3111b2b0 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -222,7 +222,7 @@ func crossBuildImage(platform string) (string, error) { case strings.HasPrefix(platform, "linux"): // Use an older version of libc to gain greater OS compatibility. // Debian 8 uses glibc 2.19. - tagSuffix = "main-debian8" + tagSuffix = "main-debian9" } goVersion, err := GoVersion() From 0c8159382a110c9add4470b064f1739623f03ae1 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 15 Jul 2021 09:13:30 +0100 Subject: [PATCH 6/8] Update dev-tools/mage/crossbuild.go Co-authored-by: Ivan Fernandez Calvo --- 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 dcce3111b2b0..1abd73e8f1bc 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -222,7 +222,7 @@ func crossBuildImage(platform string) (string, error) { case strings.HasPrefix(platform, "linux"): // Use an older version of libc to gain greater OS compatibility. // Debian 8 uses glibc 2.19. - tagSuffix = "main-debian9" + tagSuffix = "main-debian8" } goVersion, err := GoVersion() From ec843e0841074e7677312af899c7faf072eff9d5 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 15 Jul 2021 17:06:59 +0100 Subject: [PATCH 7/8] [packaging][auditbeat] remove package installation Delegate that particular requirement to the golang-crossbuild that should provide those dependencies --- x-pack/auditbeat/magefile.go | 95 ------------------------------------ 1 file changed, 95 deletions(-) diff --git a/x-pack/auditbeat/magefile.go b/x-pack/auditbeat/magefile.go index 7484e6465b76..aab840726b12 100644 --- a/x-pack/auditbeat/magefile.go +++ b/x-pack/auditbeat/magefile.go @@ -44,9 +44,6 @@ func Build() error { // GolangCrossBuild build the Beat binary inside of the golang-builder. // Do not use directly, use crossBuild instead. func GolangCrossBuild() error { - if d, ok := deps[devtools.Platform.Name]; ok { - mg.Deps(d) - } return devtools.GolangCrossBuild(devtools.DefaultGolangCrossBuildArgs()) } @@ -124,95 +121,3 @@ func ExportDashboard() error { func Dashboards() error { return devtools.KibanaDashboards(devtools.OSSBeatDir("module"), "module") } - -// ----------------------------------------------------------------------------- -// - Install the librpm-dev package -var ( - deps = map[string]func() error{ - "linux/386": installLinux386, - "linux/amd64": installLinuxAMD64, - "linux/arm64": installLinuxARM64, - "linux/armv5": installLinuxARMEL, - "linux/armv6": installLinuxARMEL, - "linux/armv7": installLinuxARMHF, - "linux/mips": installLinuxMIPS, - "linux/mipsle": installLinuxMIPSEL, - "linux/mips64le": installLinuxMIPS64EL, - "linux/ppc64le": installLinuxPPC64EL, - "linux/s390x": installLinuxS390X, - - //"linux/ppc64": installLinuxPpc64, - //"linux/mips64": installLinuxMips64, - } -) - -const ( - librpmDevPkgName = "librpm-dev" - - // Dependency of librpm-dev in ARM architectures, that needs to be explicitly - // installed to replace other conflicting packages pre-installed in the image. - libicuDevPkgName = "libicu-dev" -) - -func installLinuxAMD64() error { - return installDependencies("", librpmDevPkgName) -} - -func installLinuxARM64() error { - return installDependencies("arm64", librpmDevPkgName+":arm64") -} - -func installLinuxARMHF() error { - return installDependencies("armhf", librpmDevPkgName+":armhf", libicuDevPkgName+":armhf") -} - -func installLinuxARMEL() error { - return installDependencies("armel", librpmDevPkgName+":armel", libicuDevPkgName+":armel") -} - -func installLinux386() error { - return installDependencies("i386", librpmDevPkgName+":i386") -} - -func installLinuxMIPS() error { - return installDependencies("mips", librpmDevPkgName+":mips") -} - -func installLinuxMIPS64EL() error { - return installDependencies("mips64el", librpmDevPkgName+":mips64el") -} - -func installLinuxMIPSEL() error { - return installDependencies("mispel", librpmDevPkgName+":mipsel") -} - -func installLinuxPPC64EL() error { - return installDependencies("ppc64el", librpmDevPkgName+":ppc64el") -} - -func installLinuxS390X() error { - return installDependencies("s390x", librpmDevPkgName+":s390x") -} - -func installDependencies(arch string, pkgs ...string) error { - if len(pkgs) == 0 { - return nil - } - if arch != "" { - err := sh.Run("dpkg", "--add-architecture", arch) - if err != nil { - return errors.Wrap(err, "error while adding architecture") - } - } - - // TODO: This is only for debian 7 and should be removed when move to a newer OS. This flag is - // going to be used unnecessary when building using non-debian7 images - // (like when making the linux/arm binaries) and we should remove it soonish. - // See https://github.com/elastic/beats/v7/issues/11750 for more details. - if err := sh.Run("apt-get", "update", "-o", "Acquire::Check-Valid-Until=false"); err != nil { - return err - } - - args := append([]string{"install", "-y", "--no-install-recommends"}, pkgs...) - return sh.Run("apt-get", args...) -} From d5af5cc78bb7987d86d5e96a8fbf648aafae4629 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 19 Jul 2021 15:10:18 +0100 Subject: [PATCH 8/8] Remove unused dependencies to fix the linting --- x-pack/auditbeat/magefile.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/auditbeat/magefile.go b/x-pack/auditbeat/magefile.go index aab840726b12..b69b75ea9251 100644 --- a/x-pack/auditbeat/magefile.go +++ b/x-pack/auditbeat/magefile.go @@ -11,8 +11,6 @@ import ( "time" "github.com/magefile/mage/mg" - "github.com/magefile/mage/sh" - "github.com/pkg/errors" auditbeat "github.com/elastic/beats/v7/auditbeat/scripts/mage" devtools "github.com/elastic/beats/v7/dev-tools/mage"