internal/relui: pass advisory trybot when context canceled

When an advisory trybot run times out, the context is canceled.
The trybot will never complete successfully with a canceled context.
This change records the failure and approves the trybot run.

For golang/go#57725

Change-Id: I79ba2d9cf32c91180cbce70f5b51426aaa11a704
Reviewed-on: https://go-review.googlesource.com/c/build/+/464299
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Carlos Amedee 2023-01-31 12:00:55 -05:00
Родитель 892b779645
Коммит 44974d27f4
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -10,6 +10,7 @@ import (
"compress/gzip" "compress/gzip"
"context" "context"
"crypto/sha256" "crypto/sha256"
"errors"
"fmt" "fmt"
"io" "io"
"io/fs" "io/fs"
@ -774,6 +775,10 @@ func (b *BuildReleaseTasks) runAdvisoryTryBot(ctx *wf.TaskContext, bc *dashboard
ctx.Printf("Trybot Attempt failed: %v\n", err) ctx.Printf("Trybot Attempt failed: %v\n", err)
} }
} }
if errors.Is(ctx.Context.Err(), context.Canceled) {
ctx.Printf("Advisory TryBot timed out or was canceled\n")
return tryBotResult{bc.Name, passed}, nil
}
if !passed { if !passed {
ctx.Printf("Advisory TryBot failed. Check the logs and approve this task if it's okay:\n") ctx.Printf("Advisory TryBot failed. Check the logs and approve this task if it's okay:\n")
return tryBotResult{bc.Name, passed}, b.ApproveAction(ctx) return tryBotResult{bc.Name, passed}, b.ApproveAction(ctx)