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

Generate a metadata file artifact in unit test buildkite job #5708

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
5 changes: 4 additions & 1 deletion .buildkite/pipeline-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ steps:
agents:
queue: "workers"
docker: "*"
command: "CASSANDRA_HOST=cassandra make install-schema && make cover_profile" # make install-schema is needed for a server startup test. See main_test.go
commands:
- "CASSANDRA_HOST=cassandra make install-schema && make cover_profile" # make install-schema is needed for a server startup test. See main_test.go
- "./scripts/buildkite/gen_coverage_metadata.sh .build/coverage/metadata.txt"
artifact_paths:
- ".build/coverage/*.out"
- ".build/coverage/metadata.txt"
retry:
automatic:
limit: 1
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/pipeline-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ steps:
commands:
- "make .just-build" # ensure that we are not rebuilding binaries and not regenerating code
- "CASSANDRA_HOST=cassandra make install-schema && make cover_profile" # make install-schema is needed for a server startup test. See main_test.go
- "./scripts/buildkite/gen_coverage_metadata.sh .build/coverage/metadata.txt"
artifact_paths:
- ".build/coverage/*.out"
- ".build/coverage/metadata.txt"
retry:
automatic:
limit: 1
Expand Down
17 changes: 17 additions & 0 deletions scripts/buildkite/gen_coverage_metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -ex

# This script generates coverage metadata for the coverage report.
# Output is used by SonarQube integration in Uber and not used by OS repo coverage tool itself.

# Example output:
# commit-sha: 6953daa563e8e44512bc349c9608484cfd4ec4ff
# timestamp: 2024-03-04T19:29:16Z

output_path="$1"

echo "commit-sha: $(git rev-parse HEAD)" > "$output_path"
echo "timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$output_path"

echo "Coverage metadata written to $output_path"