[cloud functions] Ignore results coming from a builder retry
A retry of a CI builder on a commit that has already been tested,
or if results from a later commit has arrived, would have an empty
blamelist. Don't add them to the database, and log an error message.
Change-Id: I9b8a03ae3b545542ddaafcc39a4c5791c7aa8003
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/130423
Reviewed-by: Alexander Thomas <athom@google.com>
diff --git a/functions/node/builder.dart b/functions/node/builder.dart
index 038683d..8e106b5 100644
--- a/functions/node/builder.dart
+++ b/functions/node/builder.dart
@@ -121,6 +121,11 @@
final startCommit =
await firestore.getCommit(firstResult['previous_commit_hash']);
startIndex = startCommit['index'] + 1;
+ if (startIndex > endIndex) {
+ throw ArgumentError("Results received with empty blamelist\n"
+ "previous commit: ${firstResult['previous_commit_hash']}\n"
+ "built commit: $commitHash");
+ }
}
Future<void> fetchApprovals(Map<String, dynamic> commit) async {
if (commit.containsKey('review')) {