Fix crash due to aborted test targets (#1876)
Related to
https://github.com/bazelbuild/continuous-integration/issues/1708
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 199183e..f75a1bd 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -4026,13 +4026,20 @@
with open(path, "rt") as f:
for line in f:
if "testResult" not in line:
+ # TODO: also look at targetCompleted events that don't have
+ # a matching testResult event, since these are FAILED_TO_BUILD
continue
data = json.loads(line)
- meta = data.get("id").get("testResult")
+ meta = data.get("id", {}).get("testResult")
if not meta:
continue
+ if "testResult" not in data:
+ # No testResult field means "aborted" -> NO_STATUS
+ # TODO: show these targets in the UI?
+ continue
+
yield (
meta["label"],
meta["shard"],