ATTENTION! Please read and follow:
- if this is a _question_ about how to build / test / query / deploy using Bazel, ask it on StackOverflow instead: https://stackoverflow.com/questions/tagged/bazel
- if this is a _discussion starter_, send it to [email protected]
- if this is a _bug_ or _feature request_, fill the form below as best as you can.
Right now, I could not find a way to use environment variables in .bazelrc.
What i want to do is
$export GIT_ROOT=/workspace/project_name
and then in /workspace/project_name/.bazelrc
$cat /workspace/project_name/.bazelrc
build --action_env=GIT_ROOT="$GIT_ROOT" # where $GIT_ROOT is the environment variable.
Pass on Environment variable to a bazel rule which runs a script.
Linux and mac
bazel info release?latest
bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?Read,
Right now, I could not find a way to use environment variables in .bazelrc.
What i want to do is
$export GIT_ROOT=/workspace/project_name
and then in /workspace/project_name/.bazelrc
$cat /workspace/project_name/.bazelrc
build --action_env=GIT_ROOT="$GIT_ROOT" where $GIT_ROOT is the environment variable.
specifying --action_env with just the variable names tells bazel to inherit
that variable from the caller environment. So, adding
build --action_evn=GIT_ROOT
to the respective rc-file and an exporting GIT_ROOT in your shell provides
the information to actions without the need of changing the syntax of rc-files.
--
Klaus Aehlig
Google Germany GmbH, Erika-Mann-Str. 33, 80636 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Paul Terence Manicle, Halimah DeLaine Prado
Seems like this is solved, closing. Please reopen if necessary.
Just to make sure- the general feature isn’t solved but the specific case,
right?
On Thu, 15 Feb 2018 at 17:56 Philipp Wollermann notifications@github.com
wrote:
Closed #4635 https://github.com/bazelbuild/bazel/issues/4635.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/4635#event-1476172060, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABUIF0Q7-biDeWbgQDmjPPYOBCkbNmAPks5tVFOjgaJpZM4SEvZd
.
@ittaiz Yes, the case of "I want to have an environment variable available in the environment of my running actions" should be solved via --action_env=MY_VAR.
The case of "I want to use environment variables in my .bazelrc via string interpolation" like build --jobs=$BAZEL_MAX_JOBS is not solved, but it's not clear if we should even support it.
If you want / need that, I'd suggest to file a new FR for that :)
Most helpful comment
@ittaiz Yes, the case of "I want to have an environment variable available in the environment of my running actions" should be solved via
--action_env=MY_VAR.The case of "I want to use environment variables in my .bazelrc via string interpolation" like
build --jobs=$BAZEL_MAX_JOBSis not solved, but it's not clear if we should even support it.If you want / need that, I'd suggest to file a new FR for that :)