From 37b1f0fb5a589f3f69de65d250da9180a08742e2 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 7 Jun 2022 16:51:54 +0000 Subject: [PATCH] tools/cts: Rekick cancelled or infra-failed builds For commands like `cts update`, `cts export`: If a build completed with `StatusInfraFailure` or `StatusCanceled` and we're trying to obtain the results, re-kick the build. Bug: dawn:1342 Change-Id: I84565b06eb70e92f3b75a0ab2befd7ed83315140 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92940 Auto-Submit: Ben Clayton Kokoro: Kokoro Commit-Queue: Ben Clayton Reviewed-by: Austin Eng --- tools/src/cmd/cts/common/build.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/src/cmd/cts/common/build.go b/tools/src/cmd/cts/common/build.go index ca4985c11f..99ce99d791 100644 --- a/tools/src/cmd/cts/common/build.go +++ b/tools/src/cmd/cts/common/build.go @@ -137,9 +137,20 @@ func GetOrStartBuildsAndWait( } } + // Returns true if the build should be re-kicked + shouldKick := func(build buildbucket.Build) bool { + switch build.Status { + case buildbucket.StatusUnknown, + buildbucket.StatusInfraFailure, + buildbucket.StatusCanceled: + return true + } + return false + } + // Kick any missing builds for name, builder := range cfg.Builders { - if _, existing := builds[name]; !existing { + if build, found := builds[name]; !found || shouldKick(build) { build, err := bb.StartBuild(ctx, ps, builder, retest) if err != nil { return nil, err