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

fix: substitute build metadata (git commit) in bazel builds #7378

Merged
merged 2 commits into from
Sep 30, 2021

Conversation

devbww
Copy link
Contributor

@devbww devbww commented Sep 30, 2021

  • Use bazel's workspace_status_command to report the git commit.
  • Substitute it into google::cloud::internal::build_metadata().
  • Test that build_metadata() does not contain a "@" delimiter.

Fixes #4035.


This change is Reviewable

- Use bazel's `workspace_status_command` to report the git commit.
- Substitute it into `google::cloud::internal::build_metadata()`.
- Test that `build_metadata()` does not contain a "@" delimiter.

Fixes googleapis#4035.
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 30, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 1581fdca875704daba9dc86a72e9ffd02c08d2b5

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Sep 30, 2021

Codecov Report

Merging #7378 (5bfefdf) into main (f7080af) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7378   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files        1351     1351           
  Lines      117314   117315    +1     
=======================================
+ Hits       109864   109865    +1     
  Misses       7450     7450           
Impacted Files Coverage Δ
google/cloud/spanner/spanner_version_test.cc 94.73% <100.00%> (+0.29%) ⬆️
...cloud/pubsub/internal/subscription_session_test.cc 97.75% <0.00%> (-1.00%) ⬇️
.../cloud/storage/benchmarks/throughput_experiment.cc 74.87% <0.00%> (+0.50%) ⬆️
...le/cloud/storage/internal/curl_download_request.cc 89.62% <0.00%> (+1.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7080af...5bfefdf. Read the comment docs.

@@ -21,6 +21,14 @@ build --copt=-DGRPC_BAZEL_BUILD
# inside a docker image.
build --experimental_convenience_symlinks=ignore

# Use host-OS-specific config lines from bazelrc files.
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, this file is not loaded if google-cloud-cpp is built as part of a larger project. That is not a blocker for this change, but maybe we should document the limitations somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added such a note.

[Indeed, if this code was part of a bigger project they may not be using bazel or git, so they'd have to figure out how to generate their own build identifier.]

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 5bfefdf272897a51462dc6896def4a47bc05f8c5

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@devbww devbww marked this pull request as ready for review September 30, 2021 15:28
@devbww devbww requested a review from a team as a code owner September 30, 2021 15:28
@devbww devbww merged commit 92e742f into googleapis:main Sep 30, 2021
@devbww devbww deleted the bazel-build-metadata branch September 30, 2021 17:25
devjgm added a commit to devjgm/google-cloud-cpp that referenced this pull request Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add git commit hash to bazel builds
3 participants