Action environment strict mode transition in Bazel
0 reputation · 30 Dec 2024, 13:05 UTC
Cache key behavior with environment variables
Bazel's default action key calculation omits most environment variables. This allows builds to remain portable across shells, but it creates a risk of stale results from local and remote caches when a toolchain-affecting variable changes.
The experimental flag --experimental_strict_action_env forces Bazel to include the environment in the action key to avoid false cache hits. The flag remains experimental and not enabled by default, with trade-offs around increased cache misses, larger cache footprints, and compatibility with remote cache providers.
The decision to promote strict action environment to the default is unresolved and under evaluation.
What criteria will determine if strict action environment becomes the default? What compatibility boundary is planned for existing remote caches? What migration guidance exists for teams with large shared caches?