Skip to content

Commit 4022f53

Browse files
committed
fix: Correctly determine branch name for non-prs
Buildkite does not checkout a branch, it checks out a specific commit and stores the branch which triggered the build in the BUILDKITE_BRANCH environment variable. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent 38991c4 commit 4022f53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/integration_tests/build/test_coverage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def test_coverage(monkeypatch):
8989
# Only upload if token is present and we're in EC2
9090
if "CODECOV_TOKEN" in os.environ and global_props.is_ec2:
9191
pr_number = os.environ.get("BUILDKITE_PULL_REQUEST")
92-
_, branch, _ = utils.run_cmd("git rev-parse --abbrev-ref HEAD")
92+
branch = os.environ.get("BUILDKITE_BRANCH")
93+
94+
if not branch:
95+
branch = utils.run_cmd("git rev-parse --abbrev-ref HEAD").stdout
9396

9497
codecov_cmd = f"codecov -f {lcov_file} -F {global_props.host_linux_version}-{global_props.instance}"
9598

0 commit comments

Comments
 (0)