Skip to content

feat: add cache-optimized option for timestamp-based caching - #162

Closed
castler wants to merge 1 commit into
bazel-contrib:mainfrom
castler:enable_better_cache_reuse
Closed

feat: add cache-optimized option for timestamp-based caching#162
castler wants to merge 1 commit into
bazel-contrib:mainfrom
castler:enable_better_cache_reuse

Conversation

@castler

@castler castler commented May 8, 2026

Copy link
Copy Markdown

Adds a new cache-optimized input that, when enabled, uses timestamp-based cache keys instead of file hashes for disk and repository caches. Old caches are automatically deleted via the GitHub Actions Cache API before saving new ones.

Adds a new cache-optimized input that, when enabled, uses timestamp-based
cache keys instead of file hashes for disk and repository caches. Old
caches are automatically deleted via the GitHub Actions Cache API before
saving new ones.
@NEOatNHNG

Copy link
Copy Markdown

Duplicate of #163 ?

@titusfortner

Copy link
Copy Markdown
Contributor

I didn't even see this one before doing mine. Does my PR solve your underlying problem, or is there something more you want specifically from timestamp-based caches?

@castler

castler commented Jun 10, 2026

Copy link
Copy Markdown
Author

I didn't even see this one before doing mine. Does my PR solve your underlying problem, or is there something more you want specifically from timestamp-based caches?

Sorry, I was on sick leave.

For what I can say, I think your PR also solves my (our) problem.
I still think it is weird to create a hash over the BUILD files as identification, since it is fairly possible that the BUILD files stay the same, but the bazel cache changes (e.g. a cpp or python or what ever file changed). In that situation we would with your solution delete the old cache and upload a new one with the same hash. To avoid this, I switched to timestamps for the hash, instead of creating a hash over files.

I am not sure if this can have negative impacts, but I doubt. So I am also fine with your solution.

@castler

castler commented Jul 14, 2026

Copy link
Copy Markdown
Author

In order to cope with our requirements, we needed a more complex setup which we documented here:
https://github.com/eclipse-score/communication/blob/b3874c07d3fe7201eb7ca60b3fd6edc0df006aa3/.github/cache-strategy.md

Since this requires a very tight integration with the workflows used within a project - I do not believe this is of general usage and thus does not make sense to place into setup-bazel.

Thanks to @p0deje for the feedback he gave for this and similar PRs - which uncovered some hickups!

@castler castler closed this Jul 14, 2026
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.

3 participants