From 1f5562315bf06ce7d5a3794d924c858bfac399c4 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Fri, 17 Nov 2023 15:33:28 -0600 Subject: [PATCH] driver: add status reporting and a timeout to the remote driver bootstrap This adds status reporting for the remote driver so it shows the length of time it is spending waiting for the connection. If the service is already present, this logger isn't shown but it should help provide a message to show the user why the build is stalled. A timeout of 20 seconds has been added to the bootstrap. Signed-off-by: Jonathan A. Sternberg --- driver/remote/driver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/driver/remote/driver.go b/driver/remote/driver.go index 2efd2263..13b91306 100644 --- a/driver/remote/driver.go +++ b/driver/remote/driver.go @@ -4,6 +4,7 @@ import ( "context" "errors" "net" + "time" "github.com/docker/buildx/driver" "github.com/docker/buildx/util/progress" @@ -29,7 +30,11 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error { if err != nil { return err } - return c.Wait(ctx) + return progress.Wrap("[internal] waiting for connection", l, func(_ progress.SubLogger) error { + ctx, cancel := context.WithTimeout(ctx, 20*time.Second) + defer cancel() + return c.Wait(ctx) + }) } func (d *Driver) Info(ctx context.Context) (*driver.Info, error) {