Dockerized bazel builds with heavy use of bash and gnu tools #26891
veith4f
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello folks. I am still relatively new to bazel and just took over maintenance for a large build env that going forward I intend to fully dockerize in order to avoid having to consider different build platforms. Quite frankly, I think it is a bit of an anachronism to implement treatments for all the different platforms in todays heavily containerized world.
Many bazel library rules ship with their own binaries under the hood that implement simple stuff like writing yaml or json files and do so in a platform-aware way. Implementing such rules is very work intensive and there is a simpler, kind of obvious way to achieve determinism and reproducibility.
Bazel builds should be containerized, say in a debian container and bazel rules should make heavy use of bash scripting and gnu tooling. There should be a
bash
rule that allows running bash scripts and a large lib of rules that build on thatbash
rule to implement stuff likebase64-encode/decode
,yq
,jq
,sed
, and all these other targets that sort of naturally suggest themselves.I implemented the following
bash
rule andstamper
rule that uses it to demonstrate how this approach can be leveraged to quickly build powerful bazel rules while at the same time ensuring a stability and reproducibility.What do you guys think? Isn't this the kind of preferred way to use bazel?
Beta Was this translation helpful? Give feedback.
All reactions