From e79aece955da7bf632f14543c47708a35323f4d7 Mon Sep 17 00:00:00 2001 From: avoidik Date: Wed, 10 Jul 2024 15:25:03 +0100 Subject: [PATCH 1/7] add timeout parameter to cli and driver Signed-off-by: avoidik Signed-off-by: Viacheslav Vasilyev --- builder/builder.go | 3 ++- commands/build.go | 2 ++ commands/create.go | 6 +++++- commands/inspect.go | 4 +++- commands/ls.go | 8 +++++--- commands/rm.go | 4 +++- commands/root.go | 18 ++++++++++++++++-- controller/control/controller.go | 2 ++ controller/remote/controller.go | 5 ++--- driver/docker-container/driver.go | 2 +- driver/kubernetes/driver.go | 7 +++---- driver/kubernetes/factory.go | 5 ++--- driver/manager.go | 2 ++ driver/remote/driver.go | 3 +-- driver/remote/factory.go | 7 +++++++ 15 files changed, 56 insertions(+), 22 deletions(-) diff --git a/builder/builder.go b/builder/builder.go index 1b25ebe868f..518eb686f9f 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -343,6 +343,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) { @@ -522,7 +523,7 @@ func Create(ctx context.Context, txn *store.Txn, dockerCli command.Cli, opts Cre return nil, err } - timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second) + timeoutCtx, cancel := context.WithTimeout(ctx, opts.Timeout) defer cancel() nodes, err := b.LoadNodes(timeoutCtx, WithData()) diff --git a/commands/build.go b/commands/build.go index ba035bb6b13..fbdbf8134ed 100644 --- a/commands/build.go +++ b/commands/build.go @@ -106,6 +106,8 @@ type buildOptions struct { control.ControlOptions invokeConfig *invokeConfig + + timeout time.Duration } func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error) { diff --git a/commands/create.go b/commands/create.go index 5cc90e724a5..164ee4a9c88 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/inspect.go b/commands/inspect.go index f59de2b4e39..ecf34203981 100644 --- a/commands/inspect.go +++ b/commands/inspect.go @@ -23,6 +23,7 @@ import ( type inspectOptions struct { bootstrap bool builder string + timeout time.Duration } func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) error { @@ -34,7 +35,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) e return err } - timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second) + timeoutCtx, cancel := context.WithTimeout(ctx, in.timeout) defer cancel() nodes, err := b.LoadNodes(timeoutCtx, builder.WithData()) @@ -156,6 +157,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 3b18e42cc77..0f4b83dcc55 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -35,7 +35,8 @@ const ( ) type lsOptions struct { - format string + format string + timeout time.Duration } func runLs(ctx context.Context, dockerCli command.Cli, in lsOptions) error { @@ -55,7 +56,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, in lsOptions) error { return err } - timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second) + timeoutCtx, cancel := context.WithTimeout(ctx, in.timeout) defer cancel() eg, _ := errgroup.WithContext(timeoutCtx) @@ -92,7 +93,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{ @@ -100,6 +101,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/rm.go b/commands/rm.go index 6987cc42615..e83079c7c0f 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), @@ -150,7 +152,7 @@ func rmAllInactive(ctx context.Context, txn *store.Txn, dockerCli command.Cli, i return err } - timeoutCtx, cancel := context.WithTimeout(ctx, 20*time.Second) + timeoutCtx, cancel := context.WithTimeout(ctx, in.timeout) defer cancel() eg, _ := errgroup.WithContext(timeoutCtx) diff --git a/commands/root.go b/commands/root.go index 360b40ab884..3ce5ac1d98d 100644 --- a/commands/root.go +++ b/commands/root.go @@ -2,6 +2,7 @@ package commands import ( "os" + "time" debugcmd "github.com/docker/buildx/commands/debug" imagetoolscmd "github.com/docker/buildx/commands/imagetools" @@ -20,6 +21,8 @@ import ( "github.com/spf13/pflag" ) +const defaultTimeoutCli = 20 * time.Second + func NewRootCmd(name string, isPlugin bool, dockerCli command.Cli) *cobra.Command { var opt rootOptions cmd := &cobra.Command{ @@ -75,6 +78,7 @@ func NewRootCmd(name string, isPlugin bool, dockerCli command.Cli) *cobra.Comman type rootOptions struct { builder string debug bool + timeout time.Duration } func addCommands(cmd *cobra.Command, opts *rootOptions, dockerCli command.Cli) { @@ -83,10 +87,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), @@ -113,4 +117,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 (20 seconds)") } diff --git a/controller/control/controller.go b/controller/control/controller.go index 464dfa2bd48..d3797062946 100644 --- a/controller/control/controller.go +++ b/controller/control/controller.go @@ -3,6 +3,7 @@ package control import ( "context" "io" + "time" "github.com/docker/buildx/build" controllerapi "github.com/docker/buildx/controller/pb" @@ -30,4 +31,5 @@ type ControlOptions struct { ServerConfig string Root string Detach bool + Timeout time.Duration } diff --git a/controller/remote/controller.go b/controller/remote/controller.go index 64dfcc0f639..63e31743437 100644 --- a/controller/remote/controller.go +++ b/controller/remote/controller.go @@ -13,7 +13,6 @@ import ( "path/filepath" "strconv" "syscall" - "time" "github.com/containerd/log" "github.com/docker/buildx/build" @@ -62,7 +61,7 @@ func NewRemoteBuildxController(ctx context.Context, dockerCli command.Cli, opts serverRoot := filepath.Join(rootDir, "shared") // connect to buildx server if it is already running - ctx2, cancel := context.WithTimeout(ctx, 1*time.Second) + ctx2, cancel := context.WithTimeout(ctx, opts.Timeout) c, err := newBuildxClientAndCheck(ctx2, filepath.Join(serverRoot, defaultSocketFilename)) cancel() if err != nil { @@ -90,7 +89,7 @@ func NewRemoteBuildxController(ctx context.Context, dockerCli command.Cli, opts go wait() // wait for buildx server to be ready - ctx2, cancel = context.WithTimeout(ctx, 10*time.Second) + ctx2, cancel = context.WithTimeout(ctx, opts.Timeout) c, err = newBuildxClientAndCheck(ctx2, filepath.Join(serverRoot, defaultSocketFilename)) cancel() if err != nil { diff --git a/driver/docker-container/driver.go b/driver/docker-container/driver.go index 2eede55bb77..979223da388 100644 --- a/driver/docker-container/driver.go +++ b/driver/docker-container/driver.go @@ -214,7 +214,7 @@ func (d *Driver) wait(ctx context.Context, l progress.SubLogger) error { select { case <-ctx.Done(): return ctx.Err() - case <-time.After(time.Duration(try*120) * time.Millisecond): + case <-time.After(d.Timeout / time.Microsecond): try++ continue } diff --git a/driver/kubernetes/driver.go b/driver/kubernetes/driver.go index 289f17cdc07..d7345c67878 100644 --- a/driver/kubernetes/driver.go +++ b/driver/kubernetes/driver.go @@ -52,7 +52,6 @@ type Driver struct { configMapClient clientcorev1.ConfigMapInterface podChooser podchooser.PodChooser defaultLoad bool - timeout time.Duration } func (d *Driver) IsMobyDriver() bool { @@ -91,7 +90,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) }) @@ -105,8 +104,8 @@ func (d *Driver) wait(ctx context.Context) error { depl *appsv1.Deployment ) - timeoutChan := time.After(d.timeout) - ticker := time.NewTicker(100 * time.Millisecond) + timeoutChan := time.After(d.Timeout) + ticker := time.NewTicker(d.Timeout / time.Microsecond) defer ticker.Stop() for { diff --git a/driver/kubernetes/factory.go b/driver/kubernetes/factory.go index b25abb899b6..8a0b9f013a5 100644 --- a/driver/kubernetes/factory.go +++ b/driver/kubernetes/factory.go @@ -23,7 +23,6 @@ import ( const ( prioritySupported = 40 priorityUnsupported = 80 - defaultTimeout = 120 * time.Second ) type ClientConfig interface { @@ -134,7 +133,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 { @@ -175,7 +174,7 @@ func (f *factory) processDriverOpts(deploymentName string, namespace string, cfg } defaultLoad := false - timeout := defaultTimeout + timeout := cfg.Timeout deploymentOpt.Qemu.Image = bkimage.QemuImage diff --git a/driver/manager.go b/driver/manager.go index 400a0cdd72c..8449819a434 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" dockerclient "github.com/docker/docker/client" @@ -38,6 +39,7 @@ type InitConfig struct { Platforms []specs.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 eaf47e850ea..1850091e9d0 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" @@ -47,7 +46,7 @@ func (d *Driver) Bootstrap(ctx context.Context, l progress.Logger) error { return err } return progress.Wrap("[internal] waiting for connection", l, func(_ progress.SubLogger) error { - ctx, cancel := context.WithTimeout(ctx, 20*time.Second) + ctx, cancel := context.WithTimeout(ctx, d.Timeout) defer cancel() return c.Wait(ctx) }) diff --git a/driver/remote/factory.go b/driver/remote/factory.go index c07c08f2c7f..be3c31c253e 100644 --- a/driver/remote/factory.go +++ b/driver/remote/factory.go @@ -6,6 +6,7 @@ import ( "path/filepath" "strconv" "strings" + "time" "github.com/docker/buildx/driver" util "github.com/docker/buildx/driver/remote/util" @@ -87,6 +88,12 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver return nil, err } d.defaultLoad = parsed + case "timeout": + parsed, err := time.ParseDuration(v) + if err != nil { + return nil, err + } + d.Timeout = parsed default: return nil, errors.Errorf("invalid driver option %s for remote driver", k) } From 0f654e981b3d366bce2bb08a3eb8a2ca69cfc409 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Sat, 21 Sep 2024 12:44:40 +0100 Subject: [PATCH 2/7] add initial timeout to driver Signed-off-by: Viacheslav Vasilyev --- builder/node.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/node.go b/builder/node.go index e5a8e66d463..f38e97b161a 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" @@ -38,6 +39,8 @@ type Node struct { Labels map[string]string } +const defaultDriverTimeout = 120 * time.Second + // Nodes returns nodes for this builder. func (b *Builder) Nodes() []Node { return b.nodes @@ -129,6 +132,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 From e096f6e3b4f1d5e65568529bd0e2103d7eba00e7 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Sat, 21 Sep 2024 12:48:46 +0100 Subject: [PATCH 3/7] clarify cli timeout definition Signed-off-by: Viacheslav Vasilyev --- commands/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/root.go b/commands/root.go index 3ce5ac1d98d..e77ad8bd615 100644 --- a/commands/root.go +++ b/commands/root.go @@ -126,5 +126,5 @@ func rootFlags(options *rootOptions, flags *pflag.FlagSet) { timeoutDuration = defaultTimeoutCli } } - flags.DurationVar(&options.timeout, "timeout", timeoutDuration, "Override the default global timeout (20 seconds)") + flags.DurationVar(&options.timeout, "timeout", timeoutDuration, "Override the default global timeout (in seconds)") } From f5649216f1f6d7e7a94785dc7cebafbc12f0a570 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Sat, 21 Sep 2024 12:54:17 +0100 Subject: [PATCH 4/7] clarify cli timeout definition Signed-off-by: Viacheslav Vasilyev --- commands/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/root.go b/commands/root.go index e77ad8bd615..2243f5b8ee2 100644 --- a/commands/root.go +++ b/commands/root.go @@ -126,5 +126,5 @@ func rootFlags(options *rootOptions, flags *pflag.FlagSet) { timeoutDuration = defaultTimeoutCli } } - flags.DurationVar(&options.timeout, "timeout", timeoutDuration, "Override the default global timeout (in seconds)") + flags.DurationVar(&options.timeout, "timeout", timeoutDuration, "Override the default global timeout (as duration, for example 1m20s)") } From c839ec149720f6db17d45a05a0ba02e8a55313a5 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Thu, 3 Oct 2024 10:45:42 +0100 Subject: [PATCH 5/7] renew docs Signed-off-by: Viacheslav Vasilyev --- docs/reference/buildx.md | 9 +++++---- docs/reference/buildx_bake.md | 1 + docs/reference/buildx_build.md | 1 + docs/reference/buildx_create.md | 1 + docs/reference/buildx_debug.md | 21 +++++++++++---------- docs/reference/buildx_debug_build.md | 1 + docs/reference/buildx_dial-stdio.md | 13 +++++++------ docs/reference/buildx_du.md | 13 +++++++------ docs/reference/buildx_imagetools.md | 9 +++++---- docs/reference/buildx_imagetools_create.md | 1 + docs/reference/buildx_imagetools_inspect.md | 13 +++++++------ docs/reference/buildx_inspect.md | 11 ++++++----- docs/reference/buildx_ls.md | 9 +++++---- docs/reference/buildx_rm.md | 17 +++++++++-------- docs/reference/buildx_stop.md | 9 +++++---- docs/reference/buildx_use.md | 13 +++++++------ docs/reference/buildx_version.md | 7 ++++--- 17 files changed, 83 insertions(+), 66 deletions(-) diff --git a/docs/reference/buildx.md b/docs/reference/buildx.md index 783a136ec4a..4d296bc45c1 100644 --- a/docs/reference/buildx.md +++ b/docs/reference/buildx.md @@ -29,10 +29,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 3e02b859b09..de498d14c04 100644 --- a/docs/reference/buildx_bake.md +++ b/docs/reference/buildx_bake.md @@ -31,6 +31,7 @@ Build from a file | `--push` | `bool` | | Shorthand for `--set=*.output=type=registry` | | [`--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 801aef6f294..3232f345c9f 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -52,6 +52,7 @@ Start a build | [`--ssh`](#ssh) | `stringArray` | | SSH agent socket or keys to expose to the build (format: `default\|[=\|[,]]`) | | [`-t`](#tag), [`--tag`](#tag) | `stringArray` | | Name and optionally a tag (format: `name: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 96d71b29afc..0ae56eda658 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_debug.md b/docs/reference/buildx_debug.md index 6f72b5ccec1..9c2083f2d99 100644 --- a/docs/reference/buildx_debug.md +++ b/docs/reference/buildx_debug.md @@ -12,16 +12,17 @@ Start debugger (EXPERIMENTAL) ### Options -| Name | Type | Default | Description | -|:------------------|:---------|:--------|:--------------------------------------------------------------------------------------------------------------------| -| `--builder` | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--detach` | `bool` | `true` | Detach buildx server for the monitor (supported only on linux) (EXPERIMENTAL) | -| `--invoke` | `string` | | Launch a monitor with executing specified command (EXPERIMENTAL) | -| `--on` | `string` | `error` | When to launch the monitor ([always, error]) (EXPERIMENTAL) | -| `--progress` | `string` | `auto` | Set type of progress output (`auto`, `plain`, `tty`, `rawjson`) for the monitor. Use plain to show container output | -| `--root` | `string` | | Specify root directory of server to connect for the monitor (EXPERIMENTAL) | -| `--server-config` | `string` | | Specify buildx server config file for the monitor (used only when launching new server) (EXPERIMENTAL) | +| Name | Type | Default | Description | +|:------------------|:-----------|:--------|:--------------------------------------------------------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--detach` | `bool` | `true` | Detach buildx server for the monitor (supported only on linux) (EXPERIMENTAL) | +| `--invoke` | `string` | | Launch a monitor with executing specified command (EXPERIMENTAL) | +| `--on` | `string` | `error` | When to launch the monitor ([always, error]) (EXPERIMENTAL) | +| `--progress` | `string` | `auto` | Set type of progress output (`auto`, `plain`, `tty`, `rawjson`) for the monitor. Use plain to show container output | +| `--root` | `string` | | Specify root directory of server to connect for the monitor (EXPERIMENTAL) | +| `--server-config` | `string` | | Specify buildx server config file for the monitor (used only when launching new server) (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 be0499c2d23..cc9452ca801 100644 --- a/docs/reference/buildx_debug_build.md +++ b/docs/reference/buildx_debug_build.md @@ -48,6 +48,7 @@ Start a build | `--ssh` | `stringArray` | | SSH agent socket or keys to expose to the build (format: `default\|[=\|[,]]`) | | `-t`, `--tag` | `stringArray` | | Name and optionally a tag (format: `name: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 7fdc84ec0fe..fb951c239df 100644 --- a/docs/reference/buildx_dial-stdio.md +++ b/docs/reference/buildx_dial-stdio.md @@ -5,12 +5,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` | `quiet` | Set type of progress output (`auto`, `plain`, `tty`, `rawjson`). 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` | `quiet` | Set type of progress output (`auto`, `plain`, `tty`, `rawjson`). 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 684f717a2e0..3922fd2169a 100644 --- a/docs/reference/buildx_du.md +++ b/docs/reference/buildx_du.md @@ -9,12 +9,13 @@ Disk usage ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------| -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--filter` | `filter` | | Provide filter values | -| [`--verbose`](#verbose) | `bool` | | Provide a more verbose output | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--filter` | `filter` | | Provide filter values | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | +| [`--verbose`](#verbose) | `bool` | | Provide a more verbose output | diff --git a/docs/reference/buildx_imagetools.md b/docs/reference/buildx_imagetools.md index 42e191ddf21..9151533e2ce 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 d937d5d7c47..098a2d45c8c 100644 --- a/docs/reference/buildx_imagetools_create.md +++ b/docs/reference/buildx_imagetools_create.md @@ -20,6 +20,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`, `plain`, `tty`, `rawjson`). 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 ed98215b143..2dc2e2c35de 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 02847e8755b..6a53cc7d349 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 dba478c3063..0b220eb21fb 100644 --- a/docs/reference/buildx_ls.md +++ b/docs/reference/buildx_ls.md @@ -9,10 +9,11 @@ List builder instances ### Options -| Name | Type | Default | Description | -|:----------------------|:---------|:--------|:---------------------| -| `-D`, `--debug` | `bool` | | Enable debug logging | -| [`--format`](#format) | `string` | `table` | Format the output | +| Name | Type | Default | Description | +|:----------------------|:-----------|:--------|:---------------------------------------------------------------------| +| `-D`, `--debug` | `bool` | | Enable debug logging | +| [`--format`](#format) | `string` | `table` | Format the output | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | diff --git a/docs/reference/buildx_rm.md b/docs/reference/buildx_rm.md index bcb856e7bdf..795f1efe41d 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 dcf0430a9f3..1cddab582b9 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 6cd1652f704..9137aa89db8 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 e186812f12a..13b41712e29 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) | From d50cd115c4e86c392496e96a87668836213a4b17 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Thu, 3 Oct 2024 10:57:29 +0100 Subject: [PATCH 6/7] remove redundant timeout in ControlOptions Signed-off-by: Viacheslav Vasilyev --- commands/build.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/commands/build.go b/commands/build.go index fbdbf8134ed..ba035bb6b13 100644 --- a/commands/build.go +++ b/commands/build.go @@ -106,8 +106,6 @@ type buildOptions struct { control.ControlOptions invokeConfig *invokeConfig - - timeout time.Duration } func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error) { From 752b04eefce886a314b2ce0adce347596b024b73 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Thu, 3 Oct 2024 11:07:01 +0100 Subject: [PATCH 7/7] renew docs Signed-off-by: Viacheslav Vasilyev --- docs/reference/buildx_prune.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/reference/buildx_prune.md b/docs/reference/buildx_prune.md index d154a3f035e..46a0965832e 100644 --- a/docs/reference/buildx_prune.md +++ b/docs/reference/buildx_prune.md @@ -9,16 +9,17 @@ Remove build cache ### Options -| Name | Type | Default | Description | -|:------------------------|:---------|:--------|:-----------------------------------------------| -| `-a`, `--all` | `bool` | | Include internal/frontend images | -| [`--builder`](#builder) | `string` | | Override the configured builder instance | -| `-D`, `--debug` | `bool` | | Enable debug logging | -| `--filter` | `filter` | | Provide filter values (e.g., `until=24h`) | -| `-f`, `--force` | `bool` | | Do not prompt for confirmation | -| `--max-storage` | `bytes` | `0` | Maximum amount of disk space to keep for cache | -| `--min-storage` | `bytes` | `0` | Minimum amount of disk space to keep for cache | -| `--verbose` | `bool` | | Provide a more verbose output | +| Name | Type | Default | Description | +|:------------------------|:-----------|:--------|:---------------------------------------------------------------------| +| `-a`, `--all` | `bool` | | Include internal/frontend images | +| [`--builder`](#builder) | `string` | | Override the configured builder instance | +| `-D`, `--debug` | `bool` | | Enable debug logging | +| `--filter` | `filter` | | Provide filter values (e.g., `until=24h`) | +| `-f`, `--force` | `bool` | | Do not prompt for confirmation | +| `--max-storage` | `bytes` | `0` | Maximum amount of disk space to keep for cache | +| `--min-storage` | `bytes` | `0` | Minimum amount of disk space to keep for cache | +| `--timeout` | `duration` | `20s` | Override the default global timeout (as duration, for example 1m20s) | +| `--verbose` | `bool` | | Provide a more verbose output |