RunEnvironmentInfo

Report an issue View source Nightly · 8.4 · 8.3 · 8.2 · 8.1 · 8.0 · 7.6

A provider that can be returned from executable rules to control the environment in which their executable is executed.

Members

environment

dict RunEnvironmentInfo.environment

A map of string keys and values that represent environment variables and their values. These will be made available when the target that returns this provider is executed, either as a test or via the run command.

inherited_environment

List RunEnvironmentInfo.inherited_environment

A sequence of names of environment variables. These variables are made available with their current value taken from the shell environment when the target that returns this provider is executed, either as a test or via the run command. If a variable is contained in both environment and inherited_environment, the value inherited from the shell environment will take precedence if set. This is most useful for test rules, which run with a hermetic environment under bazel test and can use this mechanism to non-hermetically include a variable from the outer environment. By contrast, bazel run already forwards the outer environment. Note, though, that it may be surprising for an otherwise hermetic test to hardcode a non-hermetic dependency on the environment, and that this may even accidentally expose sensitive information. Prefer setting the test environment explicitly with the --test_env flag, and even then prefer to avoid using this flag and instead populate the environment explicitly.