Skip to content

Commit

Permalink
Fix coverage metadata commit info (#1323)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanisikdemir authored Mar 22, 2024
1 parent f578fed commit 81a37e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .buildkite/scripts/gen_coverage_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,23 @@ set -ex
# commit-sha: 6953daa563e8e44512bc349c9608484cfd4ec4ff
# timestamp: 2024-03-04T19:29:16Z

# Required env variables:
# - BUILDKITE_BRANCH
# - BUILDKITE_COMMIT

output_path="$1"

echo "commit-sha: $(git rev-parse HEAD)" > "$output_path"
if [ "$BUILDKITE_BRANCH" != "master" ] && [ "$BUILDKITE_BRANCH" != "origin/master" ]; then
echo "Coverage metadata is only generated for master branch. Current branch: $BUILDKITE_BRANCH"
exit 0
fi

if [ -z "$BUILDKITE_COMMIT" ]; then
echo "BUILDKITE_COMMIT is not set"
exit 1
fi

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

echo "Coverage metadata written to $output_path"
2 changes: 2 additions & 0 deletions docker/buildkite/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ services:
dockerfile: ./docker/buildkite/Dockerfile
environment:
- "GO111MODULE=on"
- BUILDKITE_BRANCH
- BUILDKITE_COMMIT
volumes:
- ../../:/go/src/go.uber.org/cadence
networks:
Expand Down

0 comments on commit 81a37e4

Please sign in to comment.