Merge pull request #2130 from jsternberg/remote-bootstrap-timeout

driver: add status reporting and a timeout to the remote driver bootstrap
This commit is contained in:
Tõnis Tiigi 2023-11-17 14:12:33 -08:00 committed by GitHub
commit 0962fdbb04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"net" "net"
"time"
"github.com/docker/buildx/driver" "github.com/docker/buildx/driver"
"github.com/docker/buildx/util/progress" "github.com/docker/buildx/util/progress"
@ -32,7 +33,11 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error {
if err != nil { if err != nil {
return err 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) { func (d *Driver) Info(ctx context.Context) (*driver.Info, error) {