rules_js icon indicating copy to clipboard operation
rules_js copied to clipboard

[FR]: Allow setting of use_default_shell_env in js_run_binary

Open jacobshirley opened this issue 2 years ago • 2 comments

What is the current behavior?

It is currently not settable as run_binary in bazel-lib does not take such a parameter. It is currently always set to false. I guess this would also require a change to that function to allow this to happen. Link to the line where it's set to false: https://github.com/aspect-build/bazel-lib/blob/e8c60a740dabc078ef40cc9fb71e753fef9f711f/lib/private/run_binary.bzl#L79

Describe the feature

It would be great to be able to have the option of setting this, especially now that env vars can be merged with the host environment: https://github.com/bazelbuild/bazel/pull/19318

In my specific use case, I am trying to pass in an --action_env without specifying the value e.g. --action_env=GCP_PROJECT_ID, however it is not getting passed down to js_run_binary. The only way I can get it to pass down is by setting the value on every Bazel call e.g. bazel build --action_env GCP_PROJECT_ID=[some value]. This means I cannot specify this variable in a .bazelrc file.

I believe that by setting use_default_shell_env it should get passed down. (See here for the same issue I am having: https://github.com/bazelbuild/bazel/issues/4912)

jacobshirley avatar Sep 30 '23 20:09 jacobshirley

+1 on this issue. We're running into the same problem of not being able to set --action_env=JAVA_HOME on npm_translate_lock without providing a full path

neeraj-retool avatar Feb 19 '24 02:02 neeraj-retool

Enabled for lifecycle hooks: https://github.com/aspect-build/rules_js/commit/93e53bbb60d966e6b4b9d3b0440739009b62bf5f

jbedard avatar Feb 25 '24 23:02 jbedard