From 44974d27f450fbc60816e91378c3c99649daf356 Mon Sep 17 00:00:00 2001 From: Carlos Amedee Date: Tue, 31 Jan 2023 12:00:55 -0500 Subject: [PATCH] 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 Reviewed-by: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Reviewed-by: Michael Knyszek --- internal/relui/workflows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/relui/workflows.go b/internal/relui/workflows.go index 47a32269..f96b4d25 100644 --- a/internal/relui/workflows.go +++ b/internal/relui/workflows.go @@ -10,6 +10,7 @@ import ( "compress/gzip" "context" "crypto/sha256" + "errors" "fmt" "io" "io/fs" @@ -774,6 +775,10 @@ func (b *BuildReleaseTasks) runAdvisoryTryBot(ctx *wf.TaskContext, bc *dashboard 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 { 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)