Set path separator, bash path, PATH and action_env for each execution platform
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
Bazel has builtin default paths for bash depending on operating system. They can be overridden by `--shell_executable`. When using remote execution towards multiple different execution platforms, e.g. both Linux and Windows in the same build, a single value for `--shell_executable` does not work. The same problem applies to `--action_env`.
The [remote execution API](https://github.com/bazelbuild/remote-apis/blob/0d21f29acdb90e1b67db5873e227051af0c80cdd/build/bazel/remote/execution/v2/remote_execution.proto#L571C60-L575C29) states that
> Path separators native to the operating system running on the worker SHOULD be used. If the `environment_variables` list contains an entry for the PATH environment variable, it SHOULD be respected. If not, the resolution process is implementation-defined.
To be able to follow the SHOULD part of the specification, I think the `platform()` API for defining execution platforms need to be updated to be able to set default action-env, path separator and shell executable as it is impossible for Bazel to know what platform is actually being defined.
A specific problem of today is that `.bat` scripts on Windows must have backslash in their paths to run, `.exe` works with both backslash and forward slash.
### Which category does this issue belong to?
Configurability, Remote Execution
### What underlying problem are you trying to solve with this feature?
Remote execution with multiple operating systems (Linux and Windows) on the remote side.
### Which operating system are you running Bazel on?
Linux and Windows
### What is the output of `bazel info release`?
release 7.3.1
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start with the platform() API and the linked remote execution API, then trace how --shell_executable and --action_env are currently applied to execution platforms. Done means Linux and Windows remote executions can receive platform-specific path separators, bash paths, PATH values, and action_env settings, including correct paths for Windows .bat scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- build-system
- Domain
- build-system, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100