Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Sep 15, 2025

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 read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] 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/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

How to test this PR locally

Run mage crossbuild and time it.

Related issues


This is an automatic backport of pull request #9094 done by [Mergify](https://mergify.com).

* 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)
@mergify mergify bot requested a review from a team as a code owner September 15, 2025 13:48
@mergify mergify bot added the backport label Sep 15, 2025
@mergify mergify bot requested review from blakerouse and kaanyalti and removed request for a team September 15, 2025 13:48
@github-actions github-actions bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog chore Tasks that just need to be done, they are neither bug, nor enhancements labels Sep 15, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @swiatekm

@swiatekm swiatekm merged commit 4528491 into 8.18 Sep 15, 2025
20 checks passed
@swiatekm swiatekm deleted the mergify/bp/8.18/pr-9094 branch September 15, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants