bazel: Recommend setting --action_env=PATH for local cache
The old configuration makes it impossible to compile Gerrit on Mac with recent versions of Bazel. The flag --experimental_strict_action_env now makes Bazel pass PATH=/bin:/usr/bin to subcommands. Building PolyGerrit requires using node from $PATH. On Macs it is impossible (even for root) to write to /usr/bin, so node has to live somewhere not in that hard-coded PATH. I'm not sure when this behavior changed in Bazel; it seems like it should have broken long ago. But it's marked experimental so we can't complain too much. The documentation of this option says: If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH or TMPDIR. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used. Passing --action_env=PATH fixes the problem. I think it should be safe(ish) to pass --action_env=PATH, since the particular setup described in our docs is not used for cross-user caching. This may not catch potential cache invalidations due to different versions of tools, but I don't see how it's any worse than when the binaries in /usr/bin get updated. Change-Id: I94543bd4801b83a66ff150baf3fb9e12ded7555f
This commit is contained in:
@@ -390,6 +390,7 @@ and add these lines to your `~/.bazelrc` file:
|
||||
build --experimental_local_disk_cache_path=/home/<user>/.gerritcodereview/bazel-cache/cas
|
||||
build --experimental_local_disk_cache
|
||||
build --experimental_strict_action_env
|
||||
build --action_env=PATH
|
||||
----
|
||||
|
||||
[NOTE] `experimental_local_disk_cache_path` must be absolute path. Expansion of `~` is
|
||||
|
Reference in New Issue
Block a user