-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Description of the problem / feature request:
In the same way as we can define in code that bazel passes on cli args on bazel run and bazel test it would be great to be able to define env vars in the same way.
Feature requests: what underlying problem are you trying to solve with this feature?
Some applications/libraries/tests/test frameworks prefer environment variables over cli args and being able to define that on a per target level in code would save the need to use external tools or test_env in a lot of cases. We also have cases where we just need env variables in ci for certain tests (that use docker) and this could also accommodate for that. Also with make var substitution or stamping we could even pass in non static env vars this way.
This could also help solving part of the issue described in #6111
Also I noticed on our team, developers where quite surprised when they saw one can set args in code but not env. So it seems some developers even have some expectations around this behaviour.
One could of course work around this by wrapping the binary into a sh_binary or similar and that is probably a reasonable solution, but the same would be true for args so parity on this would be ideal.
Have you found anything relevant by searching the web?
Not really, maybe #955 is somewhat related.