-
Notifications
You must be signed in to change notification settings - Fork 97
[8.18](backport #5392) fix: package fleet-server using golang-crossbuild #5427
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
Conversation
* fix: package fleet-server using golang-crossbuild and introduce packaging steps on every PR * feat: save artifacts during packaging for DRA * fix: disable CGO and buildmode pie * doc: add changelog fragment (cherry picked from commit 7da3f69) # Conflicts: # .buildkite/pipeline.package.mbp.yml # .buildkite/pipeline.yml # .buildkite/scripts/package.sh # Dockerfile.fips # magefile.go
Cherry-pick of 7da3f69 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
This pull request has not been merged yet. Could you please review and merge it @pkoutsovasilis? 🙏 |
(cherry picked from commit 5aa10ef)
|
What is the problem this PR solves?
The
fleet-server
binary was previously built directly on VM runners instead of using a controlled environment such asgolang-crossbuild
.This caused the binary to be dynamically linked against the host system’s GLIBC, introducing higher GLIBC requirements (≥ 2.32) than those declared in the Elastic OS support matrix (≥ 2.17).
Note that, even if the build configuration used
CGO_ENABLED=0
(which didn't before this PR) together with-buildmode=pie
, on Linux, this combination still produces a dynamically linked binary becausepie
relies on the dynamic loader (e.g./lib/ld-linux-aarch64.so.1
on arm64).How does this PR solve the problem?
golang-crossbuild
images (viamage docker:release
), avoiding linkage against host GLIBC.CGO_ENABLED=0
across builds (except for FIPS variants, which require CGO).-buildmode=pie
so that binaries are fully static, with no interpreter requirement.x86_64
andarm64
(including FIPS variants).build/distributions/**
) for DRA validation and debugging.mage docker:image
when compiling FIPS variants.As a result, Fleet Server binaries are now fully static and do not have a GLIBC requirement, restoring compatibility with Amazon Linux 2 and other supported distributions.
For example, you can download the Linux packaging artifacts from the CI steps introduced in this PR:
Running
file
against them after extraction shows static binaries:How to test this PR locally
Design Checklist
Checklist
./changelog/fragments
using the changelog toolRelated issues
This is an automatic backport of pull request #5392 done by [Mergify](https://mergify.com).