bazelbuild / bazelbuild/bazel-skylib
add use_default_shell_env attribute to run_binary
- Dominant language
- Starlark
- Stars
- 444
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
run_binary should not inherit the default_shell_env by default, or at least have an option to not inherit them..
Currently, when run_binary calls ctx.actions.run it is hardcoded that it inherits the 'default shell env'. This causes unnecessary hermeticity issues.
https://github.com/bazelbuild/bazel-skylib/blob/25a8e9d60687fee887e54dcb9560ef08777235de/rules/run_binary.bzl#L52
My suggestion is to add use_default_shell_env to the run_binary_rule so the caller can set it to false. I'd even say that it should default to False (because my opinion is that Bazel stuff should default to hermeticity).
Contributor guide
Research direction
Start in rules/run_binary.bzl around line 52, where run_binary calls ctx.actions.run with the default shell environment. Review the rule's existing attributes and callers, then determine how the requested use_default_shell_env option should control inheritance and whether the default should be false.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100