Skip to content

[9.1] (backport #9133) Cache binaries downloaded for packaging locally#9909

Merged
swiatekm merged 1 commit into9.1from
mergify/bp/9.1/pr-9133
Sep 12, 2025
Merged

[9.1] (backport #9133) Cache binaries downloaded for packaging locally#9909
swiatekm merged 1 commit into9.1from
mergify/bp/9.1/pr-9133

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Sep 12, 2025

What does this PR do?

It makes it possible to avoid re-downloading binaries on each mage package invocation. It does this by:

  • Introducing a KEEP_ARCHIVE environment variable, which, when set, prevents deletion of the binary archive in the drop path: 0e63536
  • Making the binary download code send a If-Modified-Since header based on the modification time of the existing file. If this returns a Not Modified code, we skip the download: a7ec517

The environment variable is introduced to avoid potentially breaking the CI and unified builds. We need to more carefully verify that it won't before enabling it by default.

Why is it important?

Redownloading binaries wastes time and makes agent difficult to work with on slow internet connections.

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 EXTERNAL=true SNAPSHOT=true DEV=true KEEP_ARCHIVE=true mage package twice. The second time should be faster.

Related issues


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

* Add an env variable to keep the download archive

* Only download artifacts which aren't present

* Document the KEEP_ARCHIVE env variable

* Update README.md

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

* fixup! Only download artifacts which aren't present

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 6aed8b1)
@mergify mergify bot added the backport label Sep 12, 2025
@mergify mergify bot requested a review from a team as a code owner September 12, 2025 11:00
@mergify mergify bot requested review from michalpristas and ycombinator and removed request for a team September 12, 2025 11:00
@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 12, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@elastic-sonarqube
Copy link
Copy Markdown

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
Copy Markdown
Contributor

💚 Build Succeeded

cc @swiatekm

@swiatekm swiatekm merged commit 45ae45f into 9.1 Sep 12, 2025
21 checks passed
@swiatekm swiatekm deleted the mergify/bp/9.1/pr-9133 branch September 12, 2025 12:53
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.

2 participants