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 <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Ben Clayton 2022-06-07 16:51:54 +00:00 committed by Dawn LUCI CQ
parent d574be5750
commit 37b1f0fb5a
1 changed files with 12 additions and 1 deletions

View File

@ -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