Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git hash as version information via Bazel stamp. #46

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bazel stamp variable generations
build --workspace_status_command=$(pwd)/ws_status.sh

# For release
# To use it: bazel COMMAND --config=release
build:release --compilation_mode=opt
build:release --stamp
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ go_library(
"@com_github_spf13_pflag//:pflag",
"@com_github_spf13_viper//:viper",
],
x_defs = {"main.Version": "{STABLE_GIT_COMMIT}"}
)

#
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ or, without bazel

#### Building a Production Release

`bazelisk build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //...`
`bazelisk build --config=release --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //...`

#### Building Production Packages

* `bazelisk build //:ansible_puller_deb`
* `bazelisk build //:ansible_puller_rpm`
* `bazelisk build --config=release //:ansible_puller_deb`
* `bazelisk build --config=release //:ansible_puller_rpm`


#### Debugging an Ansible Run
Expand Down
4 changes: 4 additions & 0 deletions ws_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Generates the data used by the stamping feature in bazel.

echo STABLE_GIT_COMMIT "$(git rev-parse HEAD)"
Loading