Set Bazel BUILD_EMBED_LABEL to git commit SHA with state of uncommitted changes
Kunal Parikh
Posted on January 8, 2020
The following git command:
git describe --always --dirty
produces this output:
a3da1ee # when working tree does not have uncommitted changed
a3da1ee-dirty # when working tree has uncommitted changed
Next, we plug the git describe
command into --workspace_status_command
flag
bazel build target --workspace_status_command='echo "BUILD_EMBED_LABEL `git describe --always --dirty`"'
For convenience of not having to repeat the flag, I've placed the following in .bazelrc
build --workspace_status_command='echo "BUILD_EMBED_LABEL `git describe --always --dirty`"'
π πͺ π
π©
Kunal Parikh
Posted on January 8, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
polyrepo ποΈ Monorepo vs. Polyrepo: Choosing the Right Strategy for Your Projects π
November 18, 2024