Skip to content

Conversation

@randomizedcoder
Copy link

No description provided.

@Wyverald Wyverald requested a review from fmeum June 27, 2025 19:55

## Purpose

The goal of `rules_shell` is to make working with shell scripts in Bazel more robust and reproducible, similar to how Bazel handles other languages like Go (`rules_go`) or Python (`rules_python`).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a stab at this, but I fear that we don't really live up to this promise just yet. This ruleset is more or less a faithful port of the formerly native shell rules, it's not (yet) more robust or reproducible.

There is an active proposal for integrating ctx.actions.run_shell with rules_shell as well as providing a PATH of hermetic shell tools. I would like to wait for that to be implemented before we claim this.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any README.md that you'd be able to add to give some indication to how rules_shell is supposed to be used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filmil
Thanks for your response

Sorry I'm not sure who you are asking

In general, this merge request was mostly intended to highlight that rules_shell isn't well documented. In particular, it is unclear [at least to a fool like me] what rules_shell is intending to achieve.

I strongly suspect that that team who wrote rules_shell did have a clear intent and do understand what rules_shell all about. - It would really help others to document this even minimally. It might even help the experts who do understand to stay on track :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question was for @fmeum . It would be nice if a maintainer would bootstrap a README.md with main points to know about the rule set.

name = "hello",
srcs = ["hello.sh"],
data = [":greeting.txt"],
deps = ["@bash//:bin/bash"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this could be realized as the script needs some shebang that would run first. If we want it to be truly hermetic, we would need to involve a launcher binary, a simple dep wouldn't help.

Please note that rules_shell depends on bash outside of the Bazel sandbox

```
_DEFAULT_SHELL_PATHS = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention that these are the default paths, but that you can register your own toolchains and/or set BAZEL_SH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants