-
Notifications
You must be signed in to change notification settings - Fork 203
Mount Go build cache into crossbuild container #9094
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
v1v
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to test these set of changes in some of the other BK pipelines:
- packaging -
elastic-agent/catalog-info.yaml
Lines 268 to 272 in def141d
name: elastic-agent-package description: Buildkite pipeline for packaging Elastic Agent package spec: repository: elastic/elastic-agent pipeline_file: ".buildkite/pipeline.elastic-agent-package.yml" - DRA, https://github.com/elastic/elastic-agent/blob/main/catalog-info.yaml#L312-L324
Can you please run them and copy the link to those builds in this PR please?
|
@v1v both of them succeeded at the build steps, but failed at the publishing step, even though I set them to dry-run. Not sure if that's in some way an effect of this change or if I made a mistake. See: |
|
That's an expected error, I think it does not support feature branches: https://buildkite.com/elastic/elastic-agent-package/builds/7168#01985144-a389-4509-af44-f1717edd59b2/282-310 As far as I see, you can override them with
I'm gonna run them again:
using the env variables: |
You would need to define Just be careful because without the appropriate |
v1v
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I've just left a comment; however, I'm not an expert in the build system. Please take my +1 as only an acknowledgment.
v1v
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I've just left a comment; however, I'm not an expert in the build system. Please take my +1 as only an acknowledgment.
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
b17602c to
61582a5
Compare
Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
55db0ea to
3374450
Compare
|
💚 Build Succeeded
History
cc @swiatekm |
|
Looks like the cache is around 5 GB per platform, which is a fair amount. |
pkoutsovasilis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx for addressing my comments
|
I tested the dra publishing pipelines again and didn't see any issues, merging. |
|
@Mergifyio backport 8.18 8.19 9.0 9.1 |
✅ Backports have been created
|
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit fd4de6b)
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit fd4de6b)
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit fd4de6b)
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit fd4de6b)
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- (cherry picked from commit fd4de6b) Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- (cherry picked from commit fd4de6b) Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- (cherry picked from commit fd4de6b) Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- (cherry picked from commit fd4de6b) Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
* upstream: (26 commits) fix: ensure EDOT subprocess shuts down gracefully on agent termination (#9886) [main][Automation] Update versions (#9976) Add Collector reference docs and automation (#9953) [beatreceivers] Integrate beatsauthextension (#9257) [main][Automation] Update versions (#9941) Update OTel components to v0.132.0/v1.38.0 (#9954) Enhancement/5235 wrap errors when marking upgrade (#9366) Mount Go build cache into crossbuild container (#9094) Liveness agent state (#9673) [main][Automation] Bump VM Image version to 1757725254 (#9942) Enhancement/5235 correctly wrap errors from copyActionDir and copyRunDirectory (#9349) [main][Automation] Update elastic/beats to afc53c0479ac (#9874) Add -coverpkg option when running unit test to calculate coverage across packages (#9913) Cache binaries downloaded for packaging locally (#9133) [main][Automation] Update versions (#9897) Disable flaky test TestBeatsReceiverLogs (#9891) Allow overriding AGENT_PACKAGE_VERSION and MANIFEST_URL when USE_PACKAGE_VERSION=true (#9864) add ingest-docs team as CODEOWNERS for release notes and docset.yml (#9865) fix: correct spelling of 'output' in various templates and monitoring code (#9827) k8s: Add comment around hostUsers for Universal Profiling deployments (#9847) ...
* Mount Go build cache into crossbuild container * Run crossbuild container as host user * Update dev-tools/mage/crossbuild.go Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix formatting * Control mounting mod cache with env variable * Control mounting build cache with env variable * Use a volume for Go build cache --------- Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>





What does this PR do?
Mounts the Go build cache into the golang-crossbuild container. To facilitate this and allow the container to generate the build cache, it also changes the crossbuild container to run as the host user.
This has been tested locally on both Mac and Linux, and the CI passes for this PR. It probably requires somewhat more careful testing, as permission changes in the host build cache could potentially result in breakage for unified releases.
Why is it important?
This reduces the build time of agent during packaging by around 75%. On my machine, the same-architecture build goes from 2 minutes to 25 seconds.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added tests that prove my fix is effective or that my feature works[ ] I have added an entry in./changelog/fragmentsusing the changelog tool[ ] I have added an integration test or an E2E testHow to test this PR locally
Run
mage crossbuildand time it.Related issues