bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Set path separator, bash path, PATH and action_env for each execution platform

Open moroten opened this issue 5 months ago • 3 comments

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 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

moroten avatar Sep 06 '24 06:09 moroten