From 335accabf8d0a0cc043029f86fb16dc58b90bfe6 Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Wed, 18 Oct 2023 15:45:57 +0900 Subject: [PATCH] Fixes for new printer APIs Signed-off-by: Kohei Tokunaga --- commands/build.go | 2 +- monitor/dap/dap.go | 3 ++- util/progress/printer.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/build.go b/commands/build.go index c79afa1fc12..b34070f431c 100644 --- a/commands/build.go +++ b/commands/build.go @@ -371,7 +371,7 @@ func runControllerBuild(ctx context.Context, dockerCli command.Cli, opts *contro return nil }) - if options.invoke != nil && options.invoke.invokeFlag == "debug-step" { + if options.invokeConfig != nil && options.invokeConfig.invokeFlag == "debug-step" { // Special mode where we don't get the result but get only the build definition. // In this mode, Build() doesn't perform the build therefore always fails. opts.Debug = true diff --git a/monitor/dap/dap.go b/monitor/dap/dap.go index a0d95482493..a1ba3265d20 100644 --- a/monitor/dap/dap.go +++ b/monitor/dap/dap.go @@ -36,6 +36,7 @@ import ( "github.com/moby/buildkit/identity" "github.com/moby/buildkit/solver/errdefs" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/util/progress/progressui" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -375,7 +376,7 @@ func (s *Server) launchDebugger(cfg LaunchConfig) (retErr error) { } }() var printer *progress.Printer - printer, err = progress.NewPrinter(ctx, s.outputStdoutWriter(), nil, "plain", + printer, err = progress.NewPrinter(ctx, s.outputStdoutWriter(), progressui.PlainMode, progress.WithOnClose(func() { printWarnings(s.outputStdoutWriter(), printer.Warnings()) }), diff --git a/util/progress/printer.go b/util/progress/printer.go index 25a0d28492e..11d2e7ed140 100644 --- a/util/progress/printer.go +++ b/util/progress/printer.go @@ -2,10 +2,10 @@ package progress import ( "context" + "io" "os" "sync" - "github.com/containerd/console" "github.com/docker/buildx/util/logutil" "github.com/moby/buildkit/client" "github.com/moby/buildkit/util/progress/progressui" @@ -80,7 +80,7 @@ func (p *Printer) ClearLogSource(v interface{}) { } } -func NewPrinter(ctx context.Context, out console.File, mode progressui.DisplayMode, opts ...PrinterOpt) (*Printer, error) { +func NewPrinter(ctx context.Context, out io.Writer, mode progressui.DisplayMode, opts ...PrinterOpt) (*Printer, error) { opt := &printerOpts{} for _, o := range opts { o(opt)