Closed RobertDiebels closed 8 months ago
--action_env
doesnt get propagated during bazel run
, see https://github.com/bazelbuild/bazel/issues/8578. --action_env
does work in the case where js_binary
is run with bazel build
(via js_run_binary
, and likely other ways)
@Strum355 Thanks for the reply. I've applied your suggestion in a previous setup I had which did indeed work.
I was under the impression that --action_env
would also work with bazel run
due to the cli documentation stating: "Inherits all options from build.".
However, I just went through the documentation of the bazel CLI again and --action_env
is not listed as a build option, nor a common option. So either the documentation is incorrect or --action_env
shouldn't work with both commands. I'm assuming that aspect 5.3.4
has the same commands and options as bazel's cli v7.0 here because I can't find a mapping between the two.
In any case, thanks again for the reply, I've since managed to use Make variables by passing --define ENV_VAR=value
and env = {"ENV_VAR="$(ENV_VAR)"}
of the js_binary
rule. This achieves what I had wanted to do (provide a username and password through environment variables).
What happened?
When calling a js_binary with bazel run --action_env ENV_VAR=value the underlying node execution does not have an environment variable ENV_VAR available in process.env.ENV_VAR
Version
Development (host) and target OS/architectures:
Output of
bazel --version
: aspect 5.3.4Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
How to reproduce
Any other information?
Running this on Windows 10