Skip to content

Commit

Permalink
Generate a metadata file artifact in unit test buildkite job (#5708)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanisikdemir authored Mar 4, 2024
1 parent 384c045 commit aac1eb3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
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"

0 comments on commit aac1eb3

Please sign in to comment.