diff --git a/builder/builder.go b/builder/builder.go index 9096a43b2685..37e9570058a3 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -345,6 +345,7 @@ type CreateOpts struct { Use bool Endpoint string Append bool + Timeout time.Duration } func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts CreateOpts) (*Builder, error) { @@ -525,7 +526,7 @@ func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts Cre } cancelCtx, cancel := context.WithCancelCause(ctx) - timeoutCtx, _ := context.WithTimeoutCause(cancelCtx, 20*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + timeoutCtx, _ := context.WithTimeoutCause(cancelCtx, opts.Timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent defer func() { cancel(errors.WithStack(context.Canceled)) }() nodes, err := b.LoadNodes(timeoutCtx, WithData()) diff --git a/builder/node.go b/builder/node.go index ee600017578a..9c4ff38acede 100644 --- a/builder/node.go +++ b/builder/node.go @@ -5,6 +5,7 @@ import ( "encoding/json" "sort" "strings" + "time" "github.com/containerd/platforms" "github.com/docker/buildx/driver" @@ -39,6 +40,8 @@ type Node struct { CDIDevices []client.CDIDevice } +const defaultDriverTimeout = 120 * time.Second + // Nodes returns nodes for this builder. func (b *Builder) Nodes() []Node { return b.nodes @@ -131,6 +134,7 @@ func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []N Platforms: n.Platforms, ContextPathHash: b.opts.contextPathHash, DialMeta: lno.dialMeta, + Timeout: defaultDriverTimeout, }) if err != nil { node.Err = err diff --git a/commands/create.go b/commands/create.go index d49fda4e1301..c2b9a79dc2af 100644 --- a/commands/create.go +++ b/commands/create.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "time" "github.com/docker/buildx/builder" "github.com/docker/buildx/driver" @@ -27,6 +28,7 @@ type createOptions struct { buildkitdFlags string buildkitdConfigFile string bootstrap bool + timeout time.Duration // upgrade bool // perform upgrade of the driver } @@ -61,6 +63,7 @@ func runCreate(ctx context.Context, dockerCli command.Cli, in createOptions, arg Use: in.use, Endpoint: ep, Append: in.actionAppend, + Timeout: in.timeout, }) if err != nil { return err @@ -80,7 +83,7 @@ func runCreate(ctx context.Context, dockerCli command.Cli, in createOptions, arg return nil } -func createCmd(dockerCli command.Cli) *cobra.Command { +func createCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { var options createOptions var drivers bytes.Buffer @@ -96,6 +99,7 @@ func createCmd(dockerCli command.Cli) *cobra.Command { Short: "Create a new builder instance", Args: cli.RequiresMaxArgs(1), RunE: func(cmd *cobra.Command, args []string) error { + options.timeout = rootOpts.timeout return runCreate(cmd.Context(), dockerCli, options, args) }, ValidArgsFunction: completion.Disable, diff --git a/commands/diskusage.go b/commands/diskusage.go index ce8c6752e31d..6dc7a262317d 100644 --- a/commands/diskusage.go +++ b/commands/diskusage.go @@ -65,6 +65,7 @@ type duOptions struct { filter opts.FilterOpt verbose bool format string + timeout time.Duration } func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts duOptions) error { @@ -92,7 +93,11 @@ func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts duOptions) er return err } - nodes, err := b.LoadNodes(ctx) + timeoutCtx, cancel := context.WithCancelCause(ctx) + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, opts.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + defer func() { cancel(errors.WithStack(context.Canceled)) }() + + nodes, err := b.LoadNodes(timeoutCtx) if err != nil { return err } @@ -187,6 +192,7 @@ func duCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { options.builder = rootOpts.builder + options.timeout = rootOpts.timeout return runDiskUsage(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.Disable, diff --git a/commands/inspect.go b/commands/inspect.go index 00031e44467e..b2c9867503ae 100644 --- a/commands/inspect.go +++ b/commands/inspect.go @@ -24,6 +24,7 @@ import ( type inspectOptions struct { bootstrap bool builder string + timeout time.Duration } func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) error { @@ -36,7 +37,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) e } timeoutCtx, cancel := context.WithCancelCause(ctx) - timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 20*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, in.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent defer func() { cancel(errors.WithStack(context.Canceled)) }() nodes, err := b.LoadNodes(timeoutCtx, builder.WithData()) @@ -180,6 +181,7 @@ func inspectCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { if len(args) > 0 { options.builder = args[0] } + options.timeout = rootOpts.timeout return runInspect(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.BuilderNames(dockerCli), diff --git a/commands/ls.go b/commands/ls.go index 847c4130a179..95628fa3a18e 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -40,6 +40,7 @@ const ( type lsOptions struct { format string noTrunc bool + timeout time.Duration } func runLs(ctx context.Context, dockerCli command.Cli, in lsOptions) error { @@ -60,7 +61,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, in lsOptions) error { } timeoutCtx, cancel := context.WithCancelCause(ctx) - timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 20*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, in.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent defer func() { cancel(errors.WithStack(context.Canceled)) }() eg, _ := errgroup.WithContext(timeoutCtx) @@ -97,7 +98,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, in lsOptions) error { return nil } -func lsCmd(dockerCli command.Cli) *cobra.Command { +func lsCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { var options lsOptions cmd := &cobra.Command{ @@ -105,6 +106,7 @@ func lsCmd(dockerCli command.Cli) *cobra.Command { Short: "List builder instances", Args: cli.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { + options.timeout = rootOpts.timeout return runLs(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.Disable, diff --git a/commands/prune.go b/commands/prune.go index d18b9d914b9e..cd81b03737b6 100644 --- a/commands/prune.go +++ b/commands/prune.go @@ -36,6 +36,7 @@ type pruneOptions struct { minFreeSpace opts.MemBytes force bool verbose bool + timeout time.Duration } const ( @@ -68,7 +69,11 @@ func runPrune(ctx context.Context, dockerCli command.Cli, opts pruneOptions) err return err } - nodes, err := b.LoadNodes(ctx) + timeoutCtx, cancel := context.WithCancelCause(ctx) + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, opts.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + defer func() { cancel(errors.WithStack(context.Canceled)) }() + + nodes, err := b.LoadNodes(timeoutCtx) if err != nil { return err } @@ -168,6 +173,7 @@ func pruneCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { options.builder = rootOpts.builder + options.timeout = rootOpts.timeout return runPrune(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.Disable, diff --git a/commands/rm.go b/commands/rm.go index 6f9cb000f4f8..b46d4f2cfb45 100644 --- a/commands/rm.go +++ b/commands/rm.go @@ -21,6 +21,7 @@ type rmOptions struct { keepDaemon bool allInactive bool force bool + timeout time.Duration } const ( @@ -109,6 +110,7 @@ func rmCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { } options.builders = args } + options.timeout = rootOpts.timeout return runRm(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.BuilderNames(dockerCli), @@ -152,7 +154,7 @@ func rmAllInactive(ctx context.Context, txn *store.Txn, dockerCli command.Cli, i } timeoutCtx, cancel := context.WithCancelCause(ctx) - timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 20*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, in.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent defer func() { cancel(errors.WithStack(context.Canceled)) }() eg, _ := errgroup.WithContext(timeoutCtx) diff --git a/commands/root.go b/commands/root.go index 93815cd92648..185bfaa2bec9 100644 --- a/commands/root.go +++ b/commands/root.go @@ -3,6 +3,7 @@ package commands import ( "fmt" "os" + "time" historycmd "github.com/docker/buildx/commands/history" imagetoolscmd "github.com/docker/buildx/commands/imagetools" @@ -23,6 +24,8 @@ import ( const experimentalCommandHint = `Experimental commands and flags are hidden. Set BUILDX_EXPERIMENTAL=1 to show them.` +const defaultTimeoutCli = 20 * time.Second + func NewRootCmd(name string, isPlugin bool, dockerCli *command.DockerCli) *cobra.Command { var opt rootOptions cmd := &cobra.Command{ @@ -102,6 +105,7 @@ func NewRootCmd(name string, isPlugin bool, dockerCli *command.DockerCli) *cobra type rootOptions struct { builder string debug bool + timeout time.Duration } func addCommands(cmd *cobra.Command, opts *rootOptions, dockerCli command.Cli) { @@ -110,10 +114,10 @@ func addCommands(cmd *cobra.Command, opts *rootOptions, dockerCli command.Cli) { cmd.AddCommand( buildCmd(dockerCli, opts, nil), bakeCmd(dockerCli, opts), - createCmd(dockerCli), + createCmd(dockerCli, opts), dialStdioCmd(dockerCli, opts), rmCmd(dockerCli, opts), - lsCmd(dockerCli), + lsCmd(dockerCli, opts), useCmd(dockerCli, opts), inspectCmd(dockerCli, opts), stopCmd(dockerCli, opts), @@ -139,4 +143,14 @@ func addCommands(cmd *cobra.Command, opts *rootOptions, dockerCli command.Cli) { func rootFlags(options *rootOptions, flags *pflag.FlagSet) { flags.StringVar(&options.builder, "builder", os.Getenv("BUILDX_BUILDER"), "Override the configured builder instance") flags.BoolVarP(&options.debug, "debug", "D", debug.IsEnabled(), "Enable debug logging") + + var timeoutDuration = defaultTimeoutCli + if value, ok := os.LookupEnv("BUILDX_TIMEOUT"); ok { + var err error + timeoutDuration, err = time.ParseDuration(value) + if err != nil { + timeoutDuration = defaultTimeoutCli + } + } + flags.DurationVar(&options.timeout, "timeout", timeoutDuration, "Override the default global timeout (as duration, for example 1m20s)") } diff --git a/commands/stop.go b/commands/stop.go index 89c48f2c7674..c56ef303ebd8 100644 --- a/commands/stop.go +++ b/commands/stop.go @@ -2,16 +2,19 @@ package commands import ( "context" + "time" "github.com/docker/buildx/builder" "github.com/docker/buildx/util/cobrautil/completion" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" + "github.com/pkg/errors" "github.com/spf13/cobra" ) type stopOptions struct { builder string + timeout time.Duration } func runStop(ctx context.Context, dockerCli command.Cli, in stopOptions) error { @@ -22,7 +25,12 @@ func runStop(ctx context.Context, dockerCli command.Cli, in stopOptions) error { if err != nil { return err } - nodes, err := b.LoadNodes(ctx) + + timeoutCtx, cancel := context.WithCancelCause(ctx) + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, in.timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + defer func() { cancel(errors.WithStack(context.Canceled)) }() + + nodes, err := b.LoadNodes(timeoutCtx) if err != nil { return err } @@ -42,6 +50,7 @@ func stopCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { if len(args) > 0 { options.builder = args[0] } + options.timeout = rootOpts.timeout return runStop(cmd.Context(), dockerCli, options) }, ValidArgsFunction: completion.BuilderNames(dockerCli), diff --git a/docs/reference/buildx.md b/docs/reference/buildx.md index 39d2e7e6693f..57c64cf63b6f 100644 --- a/docs/reference/buildx.md +++ b/docs/reference/buildx.md @@ -31,10 +31,11 @@ Extended build capabilities with BuildKit ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_bake.md b/docs/reference/buildx_bake.md index fa3a552f26d7..dc2e4ef0543b 100644 --- a/docs/reference/buildx_bake.md +++ b/docs/reference/buildx_bake.md @@ -32,6 +32,7 @@ Build from a file | [`--push`](#push) | `bool` | | Shorthand for `--set=*.output=type=registry`. Conditional. | | [`--sbom`](#sbom) | `string` | | Shorthand for `--set=*.attest=type=sbom` | | [`--set`](#set) | `stringArray` | | Override target value (e.g., `targetpattern.key=value`) | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index a1f4dc41ed57..c325211a9a86 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -49,6 +49,7 @@ Start a build | [`--ssh`](#ssh) | `stringArray` | | SSH agent socket or keys to expose to the build (format: `default\|[=\|[,]]`) | | [`-t`](#tag), [`--tag`](#tag) | `stringArray` | | Image identifier (format: `[registry/]repository[:tag]`) | | [`--target`](#target) | `string` | | Set the target build stage to build | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | | [`--ulimit`](#ulimit) | `ulimit` | | Ulimit options | diff --git a/docs/reference/buildx_create.md b/docs/reference/buildx_create.md index 96d71b29afce..0ae56eda6585 100644 --- a/docs/reference/buildx_create.md +++ b/docs/reference/buildx_create.md @@ -22,6 +22,7 @@ Create a new builder instance | [`--name`](#name) | `string` | | Builder instance name | | [`--node`](#node) | `string` | | Create/modify node with given name | | [`--platform`](#platform) | `stringArray` | | Fixed platforms for current node | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | | [`--use`](#use) | `bool` | | Set the current builder instance | diff --git a/docs/reference/buildx_dap.md b/docs/reference/buildx_dap.md index 3eebe3a4f1bb..9ca45415ffd3 100644 --- a/docs/reference/buildx_dap.md +++ b/docs/reference/buildx_dap.md @@ -12,10 +12,11 @@ Start debug adapter protocol compatible debugger (EXPERIMENTAL) ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_dap_build.md b/docs/reference/buildx_dap_build.md index 1358d5e9dd0d..ba34e7d84b82 100644 --- a/docs/reference/buildx_dap_build.md +++ b/docs/reference/buildx_dap_build.md @@ -41,6 +41,7 @@ Start a build | `--ssh` | `stringArray` | | SSH agent socket or keys to expose to the build (format: `default\|[=\|[,]]`) | | `-t`, `--tag` | `stringArray` | | Image identifier (format: `[registry/]repository[:tag]`) | | `--target` | `string` | | Set the target build stage to build | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | | `--ulimit` | `ulimit` | | Ulimit options | diff --git a/docs/reference/buildx_debug.md b/docs/reference/buildx_debug.md index 028be05cd3d6..f10e14af32c3 100644 --- a/docs/reference/buildx_debug.md +++ b/docs/reference/buildx_debug.md @@ -12,12 +12,13 @@ Start debugger (EXPERIMENTAL) ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:-----------------------------------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--invoke` | `string` | | Launch a monitor with executing specified command (EXPERIMENTAL) | -| `--on` | `string` | `error` | When to launch the monitor ([always, error]) (EXPERIMENTAL) | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--invoke` | `string` | | Launch a monitor with executing specified command (EXPERIMENTAL) | +| `--on` | `string` | `error` | When to launch the monitor ([always, error]) (EXPERIMENTAL) | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_debug_build.md b/docs/reference/buildx_debug_build.md index ddde975df80f..f32703f5bf60 100644 --- a/docs/reference/buildx_debug_build.md +++ b/docs/reference/buildx_debug_build.md @@ -45,6 +45,7 @@ Start a build | `--ssh` | `stringArray` | | SSH agent socket or keys to expose to the build (format: `default\|[=\|[,]]`) | | `-t`, `--tag` | `stringArray` | | Image identifier (format: `[registry/]repository[:tag]`) | | `--target` | `string` | | Set the target build stage to build | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | | `--ulimit` | `ulimit` | | Ulimit options | diff --git a/docs/reference/buildx_dial-stdio.md b/docs/reference/buildx_dial-stdio.md index 981771c1915d..e390676ae47f 100644 --- a/docs/reference/buildx_dial-stdio.md +++ b/docs/reference/buildx_dial-stdio.md @@ -9,12 +9,13 @@ Proxy current stdio streams to builder instance ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:----------------------------------------------------------------------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--platform` | `string` | | Target platform: this is used for node selection | -| `--progress` | `string` | `none` | Set type of progress output (`auto`, `plain`, `rawjson`, `tty`). Use plain to show container output | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:----------------------------------------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--platform` | `string` | | Target platform: this is used for node selection | +| `--progress` | `string` | `none` | Set type of progress output (`auto`, `plain`, `rawjson`, `tty`). Use plain to show container output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_du.md b/docs/reference/buildx_du.md index 999d2561fb10..d51831e2bc6c 100644 --- a/docs/reference/buildx_du.md +++ b/docs/reference/buildx_du.md @@ -9,13 +9,14 @@ Disk usage ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--filter`](#filter) | `filter` | | Provide filter values | -| [`--format`](#format) | `string` | | Format the output | -| [`--verbose`](#verbose) | `bool` | | Shorthand for `--format=pretty` | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--filter`](#filter) | `filter` | | Provide filter values | +| [`--format`](#format) | `string` | | Format the output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | +| [`--verbose`](#verbose) | `bool` | | Shorthand for `--format=pretty` | diff --git a/docs/reference/buildx_history.md b/docs/reference/buildx_history.md index c7f3d064f881..b51bcd733820 100644 --- a/docs/reference/buildx_history.md +++ b/docs/reference/buildx_history.md @@ -23,10 +23,11 @@ Commands to work on build records ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_export.md b/docs/reference/buildx_history_export.md index edb99ee8f546..0e7ea26c766e 100644 --- a/docs/reference/buildx_history_export.md +++ b/docs/reference/buildx_history_export.md @@ -5,13 +5,14 @@ Export build records into Docker Desktop bundle ### Options -| Name | Type | Default | Description | -|:---------------------------------------|:---------|:--------|:----------------------------------------------------| -| [`--all`](#all) | `bool` | | Export all build records for the builder | -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| [`-D`](#debug), [`--debug`](#debug) | `bool` | | Enable debug logging | -| [`--finalize`](#finalize) | `bool` | | Ensure build records are finalized before exporting | -| [`-o`](#output), [`--output`](#output) | `string` | | Output file path | +| Name | Type | Default | Description | +|:---------------------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--all`](#all) | `bool` | | Export all build records for the builder | +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| [`-D`](#debug), [`--debug`](#debug) | `bool` | | Enable debug logging | +| [`--finalize`](#finalize) | `bool` | | Ensure build records are finalized before exporting | +| [`-o`](#output), [`--output`](#output) | `string` | | Output file path | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_import.md b/docs/reference/buildx_history_import.md index 1d2c06d04cbc..3f2060e76277 100644 --- a/docs/reference/buildx_history_import.md +++ b/docs/reference/buildx_history_import.md @@ -9,11 +9,12 @@ Import build records into Docker Desktop ### Options -| Name | Type | Default | Description | -|:---------------------------------|:--------------|:--------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`-f`](#file), [`--file`](#file) | `stringArray` | | Import from a file path | +| Name | Type | Default | Description | +|:---------------------------------|:--------------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`-f`](#file), [`--file`](#file) | `stringArray` | | Import from a file path | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_inspect.md b/docs/reference/buildx_history_inspect.md index dcc202800fae..1ff466cbf8f9 100644 --- a/docs/reference/buildx_history_inspect.md +++ b/docs/reference/buildx_history_inspect.md @@ -16,11 +16,12 @@ Inspect a build record ### Options -| Name | Type | Default | Description | -|:----------------------|:---------|:---------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--format`](#format) | `string` | `pretty` | Format the output | +| Name | Type | Default | Description | +|:----------------------|:-----------|:---------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--format`](#format) | `string` | `pretty` | Format the output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_inspect_attachment.md b/docs/reference/buildx_history_inspect_attachment.md index 4099374d6020..38245b35aa78 100644 --- a/docs/reference/buildx_history_inspect_attachment.md +++ b/docs/reference/buildx_history_inspect_attachment.md @@ -9,12 +9,13 @@ Inspect a build record attachment ### Options -| Name | Type | Default | Description | -|:--------------------------|:---------|:--------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--platform`](#platform) | `string` | | Platform of attachment | -| [`--type`](#type) | `string` | | Type of attachment | +| Name | Type | Default | Description | +|:--------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--platform`](#platform) | `string` | | Platform of attachment | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | +| [`--type`](#type) | `string` | | Type of attachment | diff --git a/docs/reference/buildx_history_logs.md b/docs/reference/buildx_history_logs.md index 4f27c19b18c0..26a749dddcfb 100644 --- a/docs/reference/buildx_history_logs.md +++ b/docs/reference/buildx_history_logs.md @@ -9,11 +9,12 @@ Print the logs of a build record ### Options -| Name | Type | Default | Description | -|:--------------------------|:---------|:--------|:--------------------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--progress`](#progress) | `string` | `plain` | Set type of progress output (plain, rawjson, tty) | +| Name | Type | Default | Description | +|:--------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--progress`](#progress) | `string` | `plain` | Set type of progress output (plain, rawjson, tty) | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_ls.md b/docs/reference/buildx_history_ls.md index 9f27d238df12..fb4683ccd7c1 100644 --- a/docs/reference/buildx_history_ls.md +++ b/docs/reference/buildx_history_ls.md @@ -9,14 +9,15 @@ List build records ### Options -| Name | Type | Default | Description | -|:--------------------------|:--------------|:--------|:---------------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--filter`](#filter) | `stringArray` | | Provide filter values (e.g., `status=error`) | -| [`--format`](#format) | `string` | `table` | Format the output | -| [`--local`](#local) | `bool` | | List records for current repository only | -| [`--no-trunc`](#no-trunc) | `bool` | | Don't truncate output | +| Name | Type | Default | Description | +|:--------------------------|:--------------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--filter`](#filter) | `stringArray` | | Provide filter values (e.g., `status=error`) | +| [`--format`](#format) | `string` | `table` | Format the output | +| [`--local`](#local) | `bool` | | List records for current repository only | +| [`--no-trunc`](#no-trunc) | `bool` | | Don't truncate output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_open.md b/docs/reference/buildx_history_open.md index 0dc19702dad9..a7f934327927 100644 --- a/docs/reference/buildx_history_open.md +++ b/docs/reference/buildx_history_open.md @@ -9,10 +9,11 @@ Open a build record in Docker Desktop ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:-----------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_rm.md b/docs/reference/buildx_history_rm.md index deb922f99e52..55a7cd434022 100644 --- a/docs/reference/buildx_history_rm.md +++ b/docs/reference/buildx_history_rm.md @@ -9,11 +9,12 @@ Remove build records ### Options -| Name | Type | Default | Description | -|:----------------|:---------|:--------|:-----------------------------------------| -| [`--all`](#all) | `bool` | | Remove all build records | -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--all`](#all) | `bool` | | Remove all build records | +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_history_trace.md b/docs/reference/buildx_history_trace.md index 4b7f4dac4130..ef403a44921c 100644 --- a/docs/reference/buildx_history_trace.md +++ b/docs/reference/buildx_history_trace.md @@ -9,12 +9,13 @@ Show the OpenTelemetry trace of a build record ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------------|:-----------------------------------------| -| [`--addr`](#addr) | `string` | `127.0.0.1:0` | Address to bind the UI server | -| `--builder` | `string` | | Override the configured builder instance | -| [`--compare`](#compare) | `string` | | Compare with another build record | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------------|:---------------------------------------------------------------------| +| [`--addr`](#addr) | `string` | `127.0.0.1:0` | Address to bind the UI server | +| `--builder` | `string` | | Override the configured builder instance | +| [`--compare`](#compare) | `string` | | Compare with another build record | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_imagetools.md b/docs/reference/buildx_imagetools.md index 42e191ddf219..9151533e2cee 100644 --- a/docs/reference/buildx_imagetools.md +++ b/docs/reference/buildx_imagetools.md @@ -17,10 +17,11 @@ Commands to work on images in registry ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_imagetools_create.md b/docs/reference/buildx_imagetools_create.md index c69fb31afcde..0c0587c3622d 100644 --- a/docs/reference/buildx_imagetools_create.md +++ b/docs/reference/buildx_imagetools_create.md @@ -21,6 +21,7 @@ Create a new image based on source images | `--prefer-index` | `bool` | `true` | When only a single source is specified, prefer outputting an image index or manifest list instead of performing a carbon copy | | `--progress` | `string` | `auto` | Set type of progress output (`auto`, `none`, `plain`, `rawjson`, `tty`). Use plain to show container output | | [`-t`](#tag), [`--tag`](#tag) | `stringArray` | | Set reference for new image | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_imagetools_inspect.md b/docs/reference/buildx_imagetools_inspect.md index ed98215b143a..2dc2e2c35ded 100644 --- a/docs/reference/buildx_imagetools_inspect.md +++ b/docs/reference/buildx_imagetools_inspect.md @@ -9,12 +9,13 @@ Show details of an image in the registry ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:----------------|:----------------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--format`](#format) | `string` | `{{.Manifest}}` | Format the output using the given Go template | -| [`--raw`](#raw) | `bool` | | Show original, unformatted JSON manifest | +| Name | Type | Default | Description | +|:------------------------|:-----------|:----------------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--format`](#format) | `string` | `{{.Manifest}}` | Format the output using the given Go template | +| [`--raw`](#raw) | `bool` | | Show original, unformatted JSON manifest | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_inspect.md b/docs/reference/buildx_inspect.md index 02847e8755b1..6a53cc7d3491 100644 --- a/docs/reference/buildx_inspect.md +++ b/docs/reference/buildx_inspect.md @@ -9,11 +9,12 @@ Inspect current builder instance ### Options -| Name | Type | Default | Description | -|:----------------------------|:---------|:--------|:--------------------------------------------| -| [`--bootstrap`](#bootstrap) | `bool` | | Ensure builder has booted before inspecting | -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--bootstrap`](#bootstrap) | `bool` | | Ensure builder has booted before inspecting | +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_ls.md b/docs/reference/buildx_ls.md index 1b0d89a0e9cc..dd1edd479bb5 100644 --- a/docs/reference/buildx_ls.md +++ b/docs/reference/buildx_ls.md @@ -9,11 +9,12 @@ List builder instances ### Options -| Name | Type | Default | Description | -|:----------------------|:---------|:--------|:----------------------| -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--format`](#format) | `string` | `table` | Format the output | -| `--no-trunc` | `bool` | | Don't truncate output | +| Name | Type | Default | Description | +|:----------------------|:-----------|:--------|:---------------------------------------------------------------------| +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--format`](#format) | `string` | `table` | Format the output | +| `--no-trunc` | `bool` | | Don't truncate output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_prune.md b/docs/reference/buildx_prune.md index 242a879a658c..f646be54ab1a 100644 --- a/docs/reference/buildx_prune.md +++ b/docs/reference/buildx_prune.md @@ -9,17 +9,18 @@ Remove build cache ### Options -| Name | Type | Default | Description | -|:--------------------------------------|:---------|:--------|:-------------------------------------------------------| -| [`-a`](#all), [`--all`](#all) | `bool` | | Include internal/frontend images | -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--filter`](#filter) | `filter` | | Provide filter values | -| `-f`, `--force` | `bool` | | Do not prompt for confirmation | -| [`--max-used-space`](#max-used-space) | `bytes` | `0` | Maximum amount of disk space allowed to keep for cache | -| [`--min-free-space`](#min-free-space) | `bytes` | `0` | Target amount of free disk space after pruning | -| [`--reserved-space`](#reserved-space) | `bytes` | `0` | Amount of disk space always allowed to keep for cache | -| `--verbose` | `bool` | | Provide a more verbose output | +| Name | Type | Default | Description | +|:--------------------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`-a`](#all), [`--all`](#all) | `bool` | | Include internal/frontend images | +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--filter`](#filter) | `filter` | | Provide filter values | +| `-f`, `--force` | `bool` | | Do not prompt for confirmation | +| [`--max-used-space`](#max-used-space) | `bytes` | `0` | Maximum amount of disk space allowed to keep for cache | +| [`--min-free-space`](#min-free-space) | `bytes` | `0` | Target amount of free disk space after pruning | +| [`--reserved-space`](#reserved-space) | `bytes` | `0` | Amount of disk space always allowed to keep for cache | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | +| `--verbose` | `bool` | | Provide a more verbose output | diff --git a/docs/reference/buildx_rm.md b/docs/reference/buildx_rm.md index 996bacd57daf..a659feb7c616 100644 --- a/docs/reference/buildx_rm.md +++ b/docs/reference/buildx_rm.md @@ -9,14 +9,15 @@ Remove one or more builder instances ### Options -| Name | Type | Default | Description | -|:------------------------------------|:---------|:--------|:-----------------------------------------| -| [`--all-inactive`](#all-inactive) | `bool` | | Remove all inactive builders | -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`-f`](#force), [`--force`](#force) | `bool` | | Do not prompt for confirmation | -| [`--keep-daemon`](#keep-daemon) | `bool` | | Keep the BuildKit daemon running | -| [`--keep-state`](#keep-state) | `bool` | | Keep BuildKit state | +| Name | Type | Default | Description | +|:------------------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--all-inactive`](#all-inactive) | `bool` | | Remove all inactive builders | +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`-f`](#force), [`--force`](#force) | `bool` | | Do not prompt for confirmation | +| [`--keep-daemon`](#keep-daemon) | `bool` | | Keep the BuildKit daemon running | +| [`--keep-state`](#keep-state) | `bool` | | Keep BuildKit state | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_stop.md b/docs/reference/buildx_stop.md index 6493f8551629..ab79ea19fe9b 100644 --- a/docs/reference/buildx_stop.md +++ b/docs/reference/buildx_stop.md @@ -9,10 +9,11 @@ Stop builder instance ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_use.md b/docs/reference/buildx_use.md index bf8bb97fdb37..205150a223ae 100644 --- a/docs/reference/buildx_use.md +++ b/docs/reference/buildx_use.md @@ -9,12 +9,13 @@ Set the current builder instance ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-------------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--default` | `bool` | | Set builder as default for current context | -| `--global` | `bool` | | Builder persists context changes | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--default` | `bool` | | Set builder as default for current context | +| `--global` | `bool` | | Builder persists context changes | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_version.md b/docs/reference/buildx_version.md index e186812f12a9..13b41712e296 100644 --- a/docs/reference/buildx_version.md +++ b/docs/reference/buildx_version.md @@ -9,9 +9,10 @@ Show buildx version information ### Options -| Name | Type | Default | Description | -|:----------------|:-------|:--------|:---------------------| -| `-D`, `--debug` | `bool` | | Enable debug logging | +| Name | Type | Default | Description | +|:----------------|:-----------|:--------|:---------------------------------------------------------------------| +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/driver/kubernetes/driver.go b/driver/kubernetes/driver.go index 3e94f639521f..6218ef8b9eb1 100644 --- a/driver/kubernetes/driver.go +++ b/driver/kubernetes/driver.go @@ -55,7 +55,6 @@ type Driver struct { configMapClient clientcorev1.ConfigMapInterface podChooser podchooser.PodChooser defaultLoad bool - timeout time.Duration } func (d *Driver) IsMobyDriver() bool { @@ -94,7 +93,7 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error { } } return sub.Wrap( - fmt.Sprintf("waiting for %d pods to be ready, timeout: %s", d.minReplicas, units.HumanDuration(d.timeout)), + fmt.Sprintf("waiting for %d pods to be ready, timeout: %s", d.minReplicas, units.HumanDuration(d.Timeout)), func() error { return d.wait(ctx) }) @@ -108,7 +107,7 @@ func (d *Driver) wait(ctx context.Context) error { depl *appsv1.Deployment ) - timeoutChan := time.After(d.timeout) + timeoutChan := time.After(d.Timeout) ticker := time.NewTicker(100 * time.Millisecond) defer ticker.Stop() diff --git a/driver/kubernetes/factory.go b/driver/kubernetes/factory.go index dcf196d76c80..914ab4a8518f 100644 --- a/driver/kubernetes/factory.go +++ b/driver/kubernetes/factory.go @@ -134,7 +134,7 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver } d.defaultLoad = defaultLoad - d.timeout = timeout + d.Timeout = timeout d.deployment, d.configMaps, err = manifest.NewDeployment(deploymentOpt) if err != nil { diff --git a/driver/manager.go b/driver/manager.go index 54bf860ecf76..4e2842c8114e 100644 --- a/driver/manager.go +++ b/driver/manager.go @@ -4,6 +4,7 @@ import ( "context" "sort" "sync" + "time" "github.com/docker/cli/cli/context/store" "github.com/moby/buildkit/client" @@ -39,6 +40,7 @@ type InitConfig struct { Platforms []ocispecs.Platform ContextPathHash string DialMeta map[string][]string + Timeout time.Duration } var drivers map[string]Factory diff --git a/driver/remote/driver.go b/driver/remote/driver.go index 495a487e04d1..9e205adb3b64 100644 --- a/driver/remote/driver.go +++ b/driver/remote/driver.go @@ -8,7 +8,6 @@ import ( "os" "strings" "sync" - "time" "github.com/docker/buildx/driver" util "github.com/docker/buildx/driver/remote/util" @@ -48,7 +47,7 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error { } return progress.Wrap("[internal] waiting for connection", l, func(_ progress.SubLogger) error { cancelCtx, cancel := context.WithCancelCause(ctx) - ctx, _ := context.WithTimeoutCause(cancelCtx, 20*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent + ctx, _ := context.WithTimeoutCause(cancelCtx, d.Timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent defer func() { cancel(errors.WithStack(context.Canceled)) }() return c.Wait(ctx) })