Skip to content

Add skip-cache-restore option#171

Open
lurtz wants to merge 2 commits into
bazel-contrib:mainfrom
lurtz:skip-cache-restore
Open

Add skip-cache-restore option#171
lurtz wants to merge 2 commits into
bazel-contrib:mainfrom
lurtz:skip-cache-restore

Conversation

@lurtz

@lurtz lurtz commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This is useful for rebuilding caches. The current cache restore fallback logic leads to saving only one Github cache for each cache type and never updating it. Over time caches and code start to drift, which requires refreshing caches. With skip-cache-restore they can be refreshed if needed.

Because the repository cache can also change by e.g. changes in .bazelversion, add the lockfile to avoid hash collisions. Otherwise writing a new cache might fail, even if its content differs.

lurtz added 2 commits July 1, 2026 11:44
This is useful for rebuilding caches. The current cache restore fallback logic leads to saving only one Github cache for each cache type and never updating it. Over time caches and code start to drift, which requires refreshing caches. With `skip-cache-restore` they can be refreshed if needed.
The content of the repository cache can be influenced by more than MODULE.bazel or the WORKSPACE files. E.g. .bazelversion or files included by MODULE.bazel can either define the version of dependencies or pull in more. As these will eventually land in the lockfile add it to the hash to have different hash values on changes of pulled in dependencies.
@lurtz lurtz marked this pull request as ready for review July 1, 2026 11:56
@lurtz

lurtz commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

FYI I wondered if it makes sense to treat the repository and disk cache individually, but decided against that. If you think this is useful I can change the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant