bazel-contrib / bazel-contrib/setup-bazel

Should all caches, not just disk-cache, take custom keys? (or one universal key for all caches)

Open
#73 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
83
Forks
32
PR merge metrics
No merged PRs in 30d

Description

If you have multiple jobs (or a matrix), I find that the bazelisk and repository caches conflict on their initial creation. In the case of bazelisk, each job attempts to write an identical bazelisk cache, one succeeds, and the others all report a warning. This also occurs for the repository caches, but I think these shouldn't even be shared. Different jobs might build different targets and end up fetching different dependencies.

One solution might be to add a `cache-key` option that all caches use (but allow `disk-cache` to still override this, for backwards compatibility). An alternative solution would be to try to hide that warning for bazelisk, and recommend using an initial `bazel fetch` job to populate the cache.

Some example warnings:

![Image](https://github.com/user-attachments/assets/092c1f01-b3bf-4f4b-89d4-a8cec2d931bd)

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by tracing how the bazelisk, repository, and disk-cache options create and key caches, then review the five existing comments for the unresolved choice between shared custom keys and suppressing the warning. Done means the cache behavior is defined for multiple jobs or matrix runs and covered by appropriate validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, javascript
Domain
build-system, ci-cd
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.