Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop crossbuilding using Debian 8 #34921

Merged
merged 3 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ func CrossBuildImage(platform string) (string, error) {
case platform == "linux/s390x":
tagSuffix = "s390x-debian10"
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-debian10"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the main reason for using the older Debian was to build with an older version of libc. Perhaps we could use a newer version of Debian but also downgrade glibc to 2.19 (not sure if this is possible)? If possible, I think the downgrade would happen somewhere in https://github.com/elastic/golang-crossbuild/blob/main/go/base/Dockerfile.tmpl.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works #34922 I'm going to close this PR. The risk is high, as you mentioned.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to our support matrix https://www.elastic.co/support/matrix we don't support Debian < 10 since 8.4, however 7.17 still on Debian 8,9,10.

So, I think we can actually merge this to main and 8.7 but we cannot backport it to 7.17.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @andrewkroh , I recall you mentioned something in the past about backward compatibility, do you happen to know whether this PR could cause any issues? Or the underline problem was already solved?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR did cause similar problems. I detailed it in #34938 (comment) and I fixed the Packetbeat build. I added tests such that we now have tests in place that check that {File,Audit,Packet,Metric}beat are all compatible with glibc version shipped with RHEL 7.

}

goVersion, err := GoVersion()
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/mage/pkgdeps.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func installDependencies(arch string, pkgs ...string) error {
return err
}

params := append([]string{"install", "-y", "--force-yes",
params := append([]string{"install", "-y",
"--no-install-recommends",

// Journalbeat is built with old versions of Debian that don't update
Expand Down
22 changes: 2 additions & 20 deletions filebeat/scripts/mage/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package mage

import (
"strings"

"github.com/magefile/mage/mg"
"go.uber.org/multierr"

Expand All @@ -42,7 +40,7 @@ var (
)

// GolangCrossBuild builds the Beat binary inside the golang-builder and then
// checks the binaries GLIBC requirements for RHEL compatability.
// checks the binaries GLIBC requirements for RHEL compatibility.
// Do not use directly, use crossBuild instead.
func GolangCrossBuild() error {
return multierr.Combine(
Expand All @@ -65,21 +63,5 @@ func golangCrossBuild() error {

// CrossBuild cross-builds the beat for all target platforms.
func CrossBuild() error {
return devtools.CrossBuild(devtools.ImageSelector(func(platform string) (string, error) {
image, err := devtools.CrossBuildImage(platform)
if err != nil {
return "", err
}
// Normally linux/amd64 and linux/386 binaries are build using debian7
// because it has an older glibc version that makes the binaries work on
// RHEL 6, but debian7 does not have the systemd libraries needed for
// the journald input.
//
// So use the debian8 image, but test the binary to ensure that the
// linked glibc version requirement is still compatible with RHEL6.
if platform == "linux/amd64" || platform == "linux/386" {
image = strings.ReplaceAll(image, "main-debian7", "main-debian8")
}
return image, nil
}))
return devtools.CrossBuild(devtools.ImageSelector(devtools.CrossBuildImage))
}