-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Restore Maven cache from default branch #14882
Conversation
Allow to use cache from the default branch even when there are changes in any pom files.
016cccb
to
b0bd2ce
Compare
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.
What is the perceived benefit?
The number of PRs where pom changes is very low. And with this change those PRs will end up contacting Maven since the cache won't be "complete".
Note that subsequent CI runs for such PRs still uses the cache created from first run as long as pom.xml didn't change - so cache reuse already happens without this change.
The benefit is using a cache in all workflow runs. Right now, if you have a PR that modifies any pom file, it won't restore any cache and will download all dependencies. The same will happen after merging such PR to master. With this change, a cache will always be restored. In PRs that actually change any dependencies, only very few of them will need to be downloaded, if they're missing in the cache. The drawback is that new cache entries can be created with a few outdated dependencies, so they'll be growing, but we'll have to see how much. Note that PRs that change any poms are not that rare. We currently have 3 cache entries for the master branch, when a new one gets created every time we merge a PR that changes any pom files. After running
This is the reverse of what you described.
If there is a subsequent CI run at all. And such cache entry won't be reused after merging to master. |
That goes across all branches and includes more than you'd actually want. Try From what I understand of how the cache is working:
Which leads to following observations: Currently:
Proposal:
Proposal improves cache hit rate at expense of ever-inflating cache + stale cache usage. I'm open to merging this and seeing the effect in practice but we need to keep an eye on how cache is behaving and how much time we start spending downloading and creating larger caches. |
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.
Change looks good. Let's see if it helps improve things further. We can always revisit this.
I hope this helps with failures like these: https://github.com/trinodb/trino/actions/runs/3435555610/jobs/5728050172 |
Description
Allow using cache from the default branch even when there are changes in
any pom files.
Non-technical explanation
n/a
Release notes
(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: