From f2f69fb05c9e70329534cd095c7b09c9e1c97446 Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Tue, 21 Feb 2023 17:06:24 +0900 Subject: [PATCH] monitor: add `debug-shell` and `on-error` Signed-off-by: Kohei Tokunaga --- build/build.go | 373 ++++++++++++++++++++------ commands/build.go | 103 +++++--- commands/debug-shell.go | 63 +++++ commands/root.go | 1 + controller/build/build.go | 50 ++++ controller/control/controller.go | 1 + controller/errdefs/build.go | 34 +++ controller/errdefs/errdefs.pb.go | 77 ++++++ controller/errdefs/errdefs.proto | 9 + controller/errdefs/generate.go | 3 + controller/local/controller.go | 36 ++- controller/pb/controller.pb.go | 381 ++++++++++++++++++--------- controller/pb/controller.proto | 10 + controller/remote/client.go | 10 + controller/remote/controller.go | 6 +- controller/remote/server.go | 50 +++- docs/reference/buildx.md | 1 + docs/reference/buildx_debug-shell.md | 18 ++ go.mod | 2 +- monitor/monitor.go | 62 ++++- 20 files changed, 1016 insertions(+), 274 deletions(-) create mode 100644 commands/debug-shell.go create mode 100644 controller/errdefs/build.go create mode 100644 controller/errdefs/errdefs.pb.go create mode 100644 controller/errdefs/errdefs.proto create mode 100644 controller/errdefs/generate.go create mode 100644 docs/reference/buildx_debug-shell.md diff --git a/build/build.go b/build/build.go index aec66172a248..e14f141e965b 100644 --- a/build/build.go +++ b/build/build.go @@ -16,6 +16,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "syscall" "time" @@ -674,12 +675,43 @@ type ContainerConfig struct { Env []string User *string Cwd *string + + Initial bool } // ResultContext is a build result with the client that built it. type ResultContext struct { Client *client.Client Res *gateway.Result + Err *errdefs.SolveError + + // GwClient allows to use the result/error on the specified gateway client. + GwClient gateway.Client + + // GwCtx allows to use the result/error on the specified gateway client context. + GwCtx context.Context + + gwDoneCh chan struct{} + gwDoneOnce sync.Once +} + +func (r *ResultContext) Done() { + if r.gwDoneCh == nil { + return + } + r.gwDoneOnce.Do(func() { + close(r.gwDoneCh) + r.gwDoneCh = nil + }) +} + +func (r *ResultContext) Build(buildFunc gateway.BuildFunc) (err error) { + if r.GwClient == nil || r.GwCtx == nil { + _, err = r.Client.Build(context.TODO(), client.SolveOpt{}, "buildx", buildFunc, nil) + } else { + _, err = buildFunc(r.GwCtx, r.GwClient) + } + return err } // Invoke invokes a build result as a container. @@ -687,111 +719,53 @@ func Invoke(ctx context.Context, cfg ContainerConfig) error { if cfg.ResultCtx == nil { return errors.Errorf("result must be provided") } - c, res := cfg.ResultCtx.Client, cfg.ResultCtx.Res + res := cfg.ResultCtx.Res mainCtx := ctx - _, err := c.Build(context.TODO(), client.SolveOpt{}, "buildx", func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + invokeFn := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { ctx, cancel := context.WithCancel(ctx) go func() { <-mainCtx.Done() cancel() }() - if res.Ref == nil { - return nil, errors.Errorf("no reference is registered") - } - st, err := res.Ref.ToState() - if err != nil { - return nil, err - } - def, err := st.Marshal(ctx) - if err != nil { - return nil, err - } - imgRef, err := c.Solve(ctx, gateway.SolveRequest{ - Definition: def.ToPB(), - }) - if err != nil { - return nil, err - } - ctr, err := c.NewContainer(ctx, gateway.NewContainerRequest{ - Mounts: []gateway.Mount{ - { - Dest: "/", - MountType: pb.MountType_BIND, - Ref: imgRef.Ref, - }, - }, - }) - if err != nil { - return nil, err - } - defer ctr.Release(context.TODO()) - - imgData := res.Metadata[exptypes.ExporterImageConfigKey] - var img *specs.Image - if len(imgData) > 0 { - img = &specs.Image{} - if err := json.Unmarshal(imgData, img); err != nil { - fmt.Println(err) + var containerCfg gateway.NewContainerRequest + var processCfg gateway.StartRequest + if res != nil && cfg.ResultCtx.Err == nil { + logrus.Debugf("creating container from successful build") + ccfg, pcfg, err := configFromResult(ctx, c, res, cfg) + if err != nil { return nil, err } + containerCfg, processCfg = *ccfg, *pcfg + } else { + logrus.Debugf("creating container from failed build %+v", cfg) + ccfg, pcfg, err := configFromError(cfg.ResultCtx.Err, cfg) + if err != nil { + return nil, err + } + containerCfg, processCfg = *ccfg, *pcfg } - user := "" - if cfg.User != nil { - user = *cfg.User - } else if img != nil { - user = img.Config.User - } - - cwd := "" - if cfg.Cwd != nil { - cwd = *cfg.Cwd - } else if img != nil { - cwd = img.Config.WorkingDir - } - - env := []string{} - if img != nil { - env = append(env, img.Config.Env...) - } - env = append(env, cfg.Env...) - - args := []string{} - if cfg.Entrypoint != nil { - args = append(args, cfg.Entrypoint...) - } else if img != nil { - args = append(args, img.Config.Entrypoint...) - } - if cfg.Cmd != nil { - args = append(args, cfg.Cmd...) - } else if img != nil { - args = append(args, img.Config.Cmd...) + ctr, err := c.NewContainer(ctx, containerCfg) + if err != nil { + return nil, err } + defer ctr.Release(context.TODO()) - proc, err := ctr.Start(ctx, gateway.StartRequest{ - Args: args, - Env: env, - User: user, - Cwd: cwd, - Tty: cfg.Tty, - Stdin: cfg.Stdin, - Stdout: cfg.Stdout, - Stderr: cfg.Stderr, - }) + proc, err := ctr.Start(ctx, processCfg) if err != nil { return nil, errors.Errorf("failed to start container: %v", err) } errCh := make(chan error) doneCh := make(chan struct{}) go func() { + defer close(doneCh) if err := proc.Wait(); err != nil { errCh <- err return } - close(doneCh) }() select { case <-doneCh: @@ -801,8 +775,241 @@ func Invoke(ctx context.Context, cfg ContainerConfig) error { return nil, err } return nil, nil - }, nil) - return err + } + return cfg.ResultCtx.Build(invokeFn) +} + +func configFromResult(ctx context.Context, c gateway.Client, res *gateway.Result, cfg ContainerConfig) (*gateway.NewContainerRequest, *gateway.StartRequest, error) { + if res.Ref == nil { + return nil, nil, errors.Errorf("no reference is registered") + } + if cfg.Initial { + return nil, nil, errors.Errorf("starting from the container from the initial state of the step is supported only on the failed steps") + } + st, err := res.Ref.ToState() + if err != nil { + return nil, nil, err + } + def, err := st.Marshal(ctx) + if err != nil { + return nil, nil, err + } + imgRef, err := c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + if err != nil { + return nil, nil, err + } + containerCfg := gateway.NewContainerRequest{ + Mounts: []gateway.Mount{ + { + Dest: "/", + MountType: pb.MountType_BIND, + Ref: imgRef.Ref, + }, + }, + } + + imgData := res.Metadata[exptypes.ExporterImageConfigKey] + var img *specs.Image + if len(imgData) > 0 { + img = &specs.Image{} + if err := json.Unmarshal(imgData, img); err != nil { + return nil, nil, err + } + } + + user := "" + if cfg.User != nil { + user = *cfg.User + } else if img != nil { + user = img.Config.User + } + + cwd := "" + if cfg.Cwd != nil { + cwd = *cfg.Cwd + } else if img != nil { + cwd = img.Config.WorkingDir + } + + env := []string{} + if img != nil { + env = append(env, img.Config.Env...) + } + env = append(env, cfg.Env...) + + args := []string{} + if cfg.Entrypoint != nil { + args = append(args, cfg.Entrypoint...) + } else if img != nil { + args = append(args, img.Config.Entrypoint...) + } + if cfg.Cmd != nil { + args = append(args, cfg.Cmd...) + } else if img != nil { + args = append(args, img.Config.Cmd...) + } + + processCfg := gateway.StartRequest{ + Args: args, + Env: env, + User: user, + Cwd: cwd, + Tty: cfg.Tty, + Stdin: cfg.Stdin, + Stdout: cfg.Stdout, + Stderr: cfg.Stderr, + } + + return &containerCfg, &processCfg, nil +} + +func configFromError(solveErr *errdefs.SolveError, cfg ContainerConfig) (*gateway.NewContainerRequest, *gateway.StartRequest, error) { + if solveErr == nil { + return nil, nil, errors.Errorf("no result nor error is available") + } + var exec *pb.ExecOp + switch op := solveErr.Solve.Op.GetOp().(type) { + case *pb.Op_Exec: + exec = op.Exec + default: + return nil, nil, errors.Errorf("invoke: unsupported error type") + } + + var mounts []gateway.Mount + for i, mnt := range exec.Mounts { + rid := solveErr.Solve.MountIDs[i] + if cfg.Initial { + rid = solveErr.Solve.InputIDs[i] + } + mounts = append(mounts, gateway.Mount{ + Selector: mnt.Selector, + Dest: mnt.Dest, + ResultID: rid, + Readonly: mnt.Readonly, + MountType: mnt.MountType, + CacheOpt: mnt.CacheOpt, + SecretOpt: mnt.SecretOpt, + SSHOpt: mnt.SSHOpt, + }) + } + containerCfg := gateway.NewContainerRequest{ + Mounts: mounts, + NetMode: exec.Network, + } + + meta := exec.Meta + user := "" + if cfg.User != nil { + user = *cfg.User + } else { + user = meta.User + } + + cwd := "" + if cfg.Cwd != nil { + cwd = *cfg.Cwd + } else { + cwd = meta.Cwd + } + + env := append(meta.Env, cfg.Env...) + + args := []string{} + if cfg.Entrypoint != nil { + args = append(args, cfg.Entrypoint...) + } + if cfg.Cmd != nil { + args = append(args, cfg.Cmd...) + } + if len(args) == 0 { + args = meta.Args + } + + processCfg := gateway.StartRequest{ + Args: args, + Env: env, + User: user, + Cwd: cwd, + Tty: cfg.Tty, + Stdin: cfg.Stdin, + Stdout: cfg.Stdout, + Stderr: cfg.Stderr, + } + return &containerCfg, &processCfg, nil +} + +func GetResultAt(ctx context.Context, resultCtx *ResultContext, target *pb.Definition, statusChan chan *client.SolveStatus) (*ResultContext, error) { + c := resultCtx.Client + resultCtx2 := ResultContext{ + Client: resultCtx.Client, + } + + mainCtx := ctx + + doneCh := make(chan struct{}) + errCh := make(chan error) + + done := int64(0) + cancelStatusFowarding := make(chan struct{}) + defer func() { + close(cancelStatusFowarding) + atomic.StoreInt64(&done, 1) + }() + ch := make(chan *client.SolveStatus) + go func() { + for { + s := <-ch + if s == nil { + return + } + if atomic.LoadInt64(&done) == 0 { + select { + case statusChan <- s: + case <-cancelStatusFowarding: + } + } + } + }() + + go func() { + _, err := c.Build(context.TODO(), client.SolveOpt{}, "buildx", func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + res2, err := c.Solve(ctx, gateway.SolveRequest{ + Evaluate: true, + Definition: target, + }) + if err != nil { + var se *errdefs.SolveError + if errors.As(err, &se) { + resultCtx2.Err = se + } else { + return nil, err + } + } + // Record the client and ctx as well so that containers can be created from the SolveError. + resultCtx2.Res = res2 + resultCtx2.GwClient = c + resultCtx2.GwCtx = ctx + gwDoneCh := make(chan struct{}) + resultCtx2.gwDoneCh = gwDoneCh + close(doneCh) + <-gwDoneCh + return nil, nil + }, ch) + if err != nil { + errCh <- err + } + }() + + select { + case <-doneCh: + case err := <-errCh: + return nil, err + case <-mainCtx.Done(): + return nil, ctx.Err() + } + return &resultCtx2, nil } func Build(ctx context.Context, nodes []builder.Node, opt map[string]Options, docker *dockerutil.Client, configDir string, w progress.Writer) (resp map[string]*client.SolveResponse, err error) { @@ -1072,7 +1279,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s } results.Set(resultKey(dp.driverIndex, k), res) if resultHandleFunc != nil { - resultHandleFunc(dp.driverIndex, &ResultContext{cc, res}) + resultHandleFunc(dp.driverIndex, &ResultContext{Client: cc, Res: res}) } return res, nil } diff --git a/commands/build.go b/commands/build.go index 90ce152faf81..2a161b16be2d 100644 --- a/commands/build.go +++ b/commands/build.go @@ -16,6 +16,7 @@ import ( "github.com/docker/buildx/controller" cbuild "github.com/docker/buildx/controller/build" "github.com/docker/buildx/controller/control" + controllererrors "github.com/docker/buildx/controller/errdefs" controllerapi "github.com/docker/buildx/controller/pb" "github.com/docker/buildx/monitor" "github.com/docker/buildx/store" @@ -488,15 +489,7 @@ func launchControllerAndRunBuild(dockerCli command.Cli, options buildOptions) er } }() - f := ioset.NewSingleForwarder() - pr, pw := io.Pipe() - f.SetWriter(pw, func() io.WriteCloser { - pw.Close() // propagate EOF - logrus.Debug("propagating stdin close") - return nil - }) - f.SetReader(os.Stdin) - + // Start build opts, err := options.toControllerOptions() if err != nil { return err @@ -506,38 +499,59 @@ func launchControllerAndRunBuild(dockerCli command.Cli, options buildOptions) er return err } - // Avoid leaving a stale file if we eventually fail - if options.imageIDFile != "" { - if err := os.Remove(options.imageIDFile); err != nil && !os.IsNotExist(err) { - return errors.Wrap(err, "removing image ID file") + var ref string + var retErr error + f := ioset.NewSingleForwarder() + f.SetReader(os.Stdin) + if options.invoke != "debug-shell" { + pr, pw := io.Pipe() + f.SetWriter(pw, func() io.WriteCloser { + pw.Close() // propagate EOF + logrus.Debug("propagating stdin close") + return nil + }) + + // Avoid leaving a stale file if we eventually fail + if options.imageIDFile != "" { + if err := os.Remove(options.imageIDFile); err != nil && !os.IsNotExist(err) { + return errors.Wrap(err, "removing image ID file") + } } - } - // Start build - ref, resp, err := c.Build(ctx, opts, pr, os.Stdout, os.Stderr, progress) - if err != nil { - return errors.Wrapf(err, "failed to build") // TODO: allow invoke even on error - } - if err := pw.Close(); err != nil { - logrus.Debug("failed to close stdin pipe writer") - } - if err := pr.Close(); err != nil { - logrus.Debug("failed to close stdin pipe reader") - } + var resp *client.SolveResponse + ref, resp, err = c.Build(ctx, opts, pr, os.Stdout, os.Stderr, progress) + if err != nil { + var be *controllererrors.BuildError + if errors.As(err, &be) { + ref = be.Ref + retErr = err + // We can proceed to monitor + } else { + return errors.Wrapf(err, "failed to build") + } + } + if err := pw.Close(); err != nil { + logrus.Debug("failed to close stdin pipe writer") + } + if err := pr.Close(); err != nil { + logrus.Debug("failed to close stdin pipe reader") + } - if options.quiet { - fmt.Println(resp.ExporterResponse[exptypes.ExporterImageDigestKey]) - } - if options.imageIDFile != "" { - dgst := resp.ExporterResponse[exptypes.ExporterImageDigestKey] - if v, ok := resp.ExporterResponse[exptypes.ExporterImageConfigDigestKey]; ok { - dgst = v + if options.quiet { + fmt.Println(resp.ExporterResponse[exptypes.ExporterImageDigestKey]) + } + if options.imageIDFile != "" { + dgst := resp.ExporterResponse[exptypes.ExporterImageDigestKey] + if v, ok := resp.ExporterResponse[exptypes.ExporterImageConfigDigestKey]; ok { + dgst = v + } + return os.WriteFile(options.imageIDFile, []byte(dgst), 0644) } - return os.WriteFile(options.imageIDFile, []byte(dgst), 0644) + } // post-build operations - if options.invoke != "" { + if needsMonitor(options.invoke, retErr) { pr2, pw2 := io.Pipe() f.SetWriter(pw2, func() io.WriteCloser { pw2.Close() // propagate EOF @@ -550,7 +564,7 @@ func launchControllerAndRunBuild(dockerCli command.Cli, options buildOptions) er } return errors.Errorf("failed to configure terminal: %v", err) } - err = monitor.RunMonitor(ctx, ref, opts, invokeConfig, c, options.progress, pr2, os.Stdout, os.Stderr) + err = monitor.RunMonitor(ctx, ref, &opts, invokeConfig, c, progress, pr2, os.Stdout, os.Stderr) con.Reset() if err := pw2.Close(); err != nil { logrus.Debug("failed to close monitor stdin pipe reader") @@ -566,9 +580,26 @@ func launchControllerAndRunBuild(dockerCli command.Cli, options buildOptions) er return nil } +func needsMonitor(invokeFlag string, retErr error) bool { + switch invokeFlag { + case "debug-shell": + return true + case "on-error": + return retErr != nil + default: + return invokeFlag != "" + } +} + func parseInvokeConfig(invoke string) (cfg controllerapi.ContainerConfig, err error) { cfg.Tty = true - if invoke == "default" { + switch invoke { + case "default", "debug-shell": + return cfg, nil + case "on-error": + // NOTE: we overwrite the command to run because the original one should fail on the failed step. + // TODO: make this configurable. + cfg.Cmd = []string{"/bin/sh"} return cfg, nil } diff --git a/commands/debug-shell.go b/commands/debug-shell.go new file mode 100644 index 000000000000..7493e815ab0e --- /dev/null +++ b/commands/debug-shell.go @@ -0,0 +1,63 @@ +package commands + +import ( + "context" + "os" + "runtime" + + "github.com/containerd/console" + "github.com/docker/buildx/controller" + "github.com/docker/buildx/controller/control" + controllerapi "github.com/docker/buildx/controller/pb" + "github.com/docker/buildx/monitor" + "github.com/docker/cli/cli/command" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func debugShellCmd(dockerCli command.Cli) *cobra.Command { + var options control.ControlOptions + var progress string + + cmd := &cobra.Command{ + Use: "debug-shell", + Short: "Start a monitor", + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.TODO() + c, err := controller.NewController(ctx, options, dockerCli) + if err != nil { + return err + } + defer func() { + if err := c.Close(); err != nil { + logrus.Warnf("failed to close server connection %v", err) + } + }() + con := console.Current() + if err := con.SetRaw(); err != nil { + return errors.Errorf("failed to configure terminal: %v", err) + } + err = monitor.RunMonitor(ctx, "", nil, controllerapi.ContainerConfig{ + Tty: true, + }, c, progress, os.Stdin, os.Stdout, os.Stderr) + con.Reset() + return err + }, + } + + flags := cmd.Flags() + + flags.StringVar(&options.Root, "root", "", "Specify root directory of server to connect [experimental]") + flags.BoolVar(&options.Detach, "detach", runtime.GOOS == "linux", "Detach buildx server (supported only on linux) [experimental]") + flags.StringVar(&options.ServerConfig, "server-config", "", "Specify buildx server config file (used only when launching new server) [experimental]") + flags.StringVar(&progress, "progress", "auto", `Set type of progress output ("auto", "plain", "tty"). Use plain to show container output`) + + return cmd +} + +func addDebugShellCommand(cmd *cobra.Command, dockerCli command.Cli) { + cmd.AddCommand( + debugShellCmd(dockerCli), + ) +} diff --git a/commands/root.go b/commands/root.go index eda2c1e52d1c..f0cbb06d7b05 100644 --- a/commands/root.go +++ b/commands/root.go @@ -89,6 +89,7 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) { ) if isExperimental() { remote.AddControllerCommands(cmd, dockerCli) + addDebugShellCommand(cmd, dockerCli) } } diff --git a/controller/build/build.go b/controller/build/build.go index 12fa8580197a..a511a7cdded5 100644 --- a/controller/build/build.go +++ b/controller/build/build.go @@ -31,6 +31,7 @@ import ( "github.com/moby/buildkit/client" "github.com/moby/buildkit/session/auth/authprovider" "github.com/moby/buildkit/solver/errdefs" + solverpb "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/grpcerrors" "github.com/moby/buildkit/util/progress/progressui" "github.com/morikuni/aec" @@ -209,6 +210,9 @@ func buildTargets(ctx context.Context, dockerCli command.Cli, ng *store.NodeGrou err = err1 } if err != nil { + if res != nil { + err = wrapResultContext(err, res) + } return nil, nil, err } @@ -379,3 +383,49 @@ func controllerUlimitOpt2DockerUlimit(u *controllerapi.UlimitOpt) *dockeropts.Ul } return dockeropts.NewUlimitOpt(&values) } + +type ResultContextError struct { + ResultContext *build.ResultContext + error +} + +func (e *ResultContextError) Unwrap() error { + return e.error +} + +func wrapResultContext(wErr error, res *build.ResultContext) error { + if wErr == nil { + return nil + } + def, err := DefinitionFromResultContext(context.TODO(), res) + if err != nil { + logrus.Errorf("failed to get definition from result: %v", err) + return wErr + } + res2, err := build.GetResultAt(context.TODO(), res, def, nil) + if err != nil { + logrus.Errorf("failed to get result: %v", err) + return wErr + } + res.Done() + return &ResultContextError{ResultContext: res2, error: wErr} +} + +func DefinitionFromResultContext(ctx context.Context, res *build.ResultContext) (*solverpb.Definition, error) { + if res.Res == nil { + return nil, errors.Errorf("result context doesn't contain build result") + } + ref, err := res.Res.SingleRef() + if err != nil { + return nil, err + } + st, err := ref.ToState() + if err != nil { + return nil, err + } + def, err := st.Marshal(ctx) + if err != nil { + return nil, err + } + return def.ToPB(), nil +} diff --git a/controller/control/controller.go b/controller/control/controller.go index eb9b83a93270..f8b2e48810bd 100644 --- a/controller/control/controller.go +++ b/controller/control/controller.go @@ -16,6 +16,7 @@ type BuildxController interface { Close() error List(ctx context.Context) (refs []string, _ error) Disconnect(ctx context.Context, ref string) error + Inspect(ctx context.Context, ref string) (*controllerapi.InspectResponse, error) } type ControlOptions struct { diff --git a/controller/errdefs/build.go b/controller/errdefs/build.go new file mode 100644 index 000000000000..dbf30176ca2a --- /dev/null +++ b/controller/errdefs/build.go @@ -0,0 +1,34 @@ +package errdefs + +import ( + "github.com/containerd/typeurl" + "github.com/moby/buildkit/util/grpcerrors" +) + +func init() { + typeurl.Register((*Build)(nil), "github.com/docker/buildx", "errdefs.Build+json") +} + +type BuildError struct { + Build + error +} + +func (e *BuildError) Unwrap() error { + return e.error +} + +func (e *BuildError) ToProto() grpcerrors.TypedErrorProto { + return &e.Build +} + +func WrapBuild(err error, ref string) error { + if err == nil { + return nil + } + return &BuildError{Build: Build{Ref: ref}, error: err} +} + +func (b *Build) WrapError(err error) error { + return &BuildError{error: err, Build: *b} +} diff --git a/controller/errdefs/errdefs.pb.go b/controller/errdefs/errdefs.pb.go new file mode 100644 index 000000000000..b7ea9a1e53d6 --- /dev/null +++ b/controller/errdefs/errdefs.pb.go @@ -0,0 +1,77 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: errdefs.proto + +package errdefs + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + _ "github.com/moby/buildkit/solver/pb" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Build struct { + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Build) Reset() { *m = Build{} } +func (m *Build) String() string { return proto.CompactTextString(m) } +func (*Build) ProtoMessage() {} +func (*Build) Descriptor() ([]byte, []int) { + return fileDescriptor_689dc58a5060aff5, []int{0} +} +func (m *Build) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Build.Unmarshal(m, b) +} +func (m *Build) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Build.Marshal(b, m, deterministic) +} +func (m *Build) XXX_Merge(src proto.Message) { + xxx_messageInfo_Build.Merge(m, src) +} +func (m *Build) XXX_Size() int { + return xxx_messageInfo_Build.Size(m) +} +func (m *Build) XXX_DiscardUnknown() { + xxx_messageInfo_Build.DiscardUnknown(m) +} + +var xxx_messageInfo_Build proto.InternalMessageInfo + +func (m *Build) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +func init() { + proto.RegisterType((*Build)(nil), "errdefs.Build") +} + +func init() { proto.RegisterFile("errdefs.proto", fileDescriptor_689dc58a5060aff5) } + +var fileDescriptor_689dc58a5060aff5 = []byte{ + // 111 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0x2d, 0x2a, 0x4a, + 0x49, 0x4d, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x74, 0xd2, + 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x73, 0xf3, 0x93, 0x2a, 0xf5, 0x93, + 0x4a, 0x33, 0x73, 0x52, 0xb2, 0x33, 0x4b, 0xf4, 0x8b, 0xf3, 0x73, 0xca, 0x52, 0x8b, 0xf4, 0x0b, + 0x92, 0xf4, 0xf3, 0x0b, 0xa0, 0xda, 0x94, 0x24, 0xb9, 0x58, 0x9d, 0x40, 0xf2, 0x42, 0x02, 0x5c, + 0xcc, 0x41, 0xa9, 0x69, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x20, 0x66, 0x12, 0x1b, 0x58, + 0x85, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x56, 0x52, 0x41, 0x91, 0x69, 0x00, 0x00, 0x00, +} diff --git a/controller/errdefs/errdefs.proto b/controller/errdefs/errdefs.proto new file mode 100644 index 000000000000..9a7281fb6236 --- /dev/null +++ b/controller/errdefs/errdefs.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package errdefs; + +import "github.com/moby/buildkit/solver/pb/ops.proto"; + +message Build { + string Ref = 1; +} \ No newline at end of file diff --git a/controller/errdefs/generate.go b/controller/errdefs/generate.go new file mode 100644 index 000000000000..6f82237c6087 --- /dev/null +++ b/controller/errdefs/generate.go @@ -0,0 +1,3 @@ +package errdefs + +//go:generate protoc -I=. -I=../../vendor/ --gogo_out=plugins=grpc:. errdefs.proto diff --git a/controller/local/controller.go b/controller/local/controller.go index 3ec8a1772fcd..12183545700f 100644 --- a/controller/local/controller.go +++ b/controller/local/controller.go @@ -8,6 +8,7 @@ import ( "github.com/docker/buildx/build" cbuild "github.com/docker/buildx/controller/build" "github.com/docker/buildx/controller/control" + controllererrors "github.com/docker/buildx/controller/errdefs" controllerapi "github.com/docker/buildx/controller/pb" "github.com/docker/cli/cli/command" "github.com/moby/buildkit/client" @@ -22,17 +23,30 @@ func NewLocalBuildxController(ctx context.Context, dockerCli command.Cli) contro } type localController struct { - dockerCli command.Cli - ref string - resultCtx *build.ResultContext + dockerCli command.Cli + ref string + resultCtx *build.ResultContext + buildOptions *controllerapi.BuildOptions } func (b *localController) Build(ctx context.Context, options controllerapi.BuildOptions, in io.ReadCloser, w io.Writer, out console.File, progressMode string) (string, *client.SolveResponse, error) { - resp, res, err := cbuild.RunBuild(ctx, b.dockerCli, options, in, progressMode, nil) - if err != nil { - return "", nil, err + resp, res, buildErr := cbuild.RunBuild(ctx, b.dockerCli, options, in, progressMode, nil) + if buildErr != nil { + var re *cbuild.ResultContextError + if errors.As(buildErr, &re) && re.ResultContext != nil { + res = re.ResultContext + } + } + if res != nil { + b.resultCtx = res + b.buildOptions = &options + if buildErr != nil { + buildErr = controllererrors.WrapBuild(buildErr, b.ref) + } + } + if buildErr != nil { + return "", nil, buildErr } - b.resultCtx = res return b.ref, resp, nil } @@ -52,6 +66,7 @@ func (b *localController) Invoke(ctx context.Context, ref string, cfg controller Stdin: ioIn, Stdout: ioOut, Stderr: ioErr, + Initial: cfg.Initial, } if !cfg.NoUser { ccfg.User = &cfg.User @@ -78,3 +93,10 @@ func (b *localController) List(ctx context.Context) (res []string, _ error) { func (b *localController) Disconnect(ctx context.Context, key string) error { return nil // nop } + +func (b *localController) Inspect(ctx context.Context, ref string) (*controllerapi.InspectResponse, error) { + if ref != b.ref { + return nil, errors.Errorf("unknown ref %q", ref) + } + return &controllerapi.InspectResponse{Options: b.buildOptions}, nil +} diff --git a/controller/pb/controller.pb.go b/controller/pb/controller.pb.go index 55c0a737a534..2d7e3262b3fd 100644 --- a/controller/pb/controller.pb.go +++ b/controller/pb/controller.pb.go @@ -539,6 +539,82 @@ func (m *Secret) GetEnv() string { return "" } +type InspectRequest struct { + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InspectRequest) Reset() { *m = InspectRequest{} } +func (m *InspectRequest) String() string { return proto.CompactTextString(m) } +func (*InspectRequest) ProtoMessage() {} +func (*InspectRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7f10298fa1d90f, []int{7} +} +func (m *InspectRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InspectRequest.Unmarshal(m, b) +} +func (m *InspectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InspectRequest.Marshal(b, m, deterministic) +} +func (m *InspectRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InspectRequest.Merge(m, src) +} +func (m *InspectRequest) XXX_Size() int { + return xxx_messageInfo_InspectRequest.Size(m) +} +func (m *InspectRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InspectRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_InspectRequest proto.InternalMessageInfo + +func (m *InspectRequest) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +type InspectResponse struct { + Options *BuildOptions `protobuf:"bytes,1,opt,name=Options,proto3" json:"Options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InspectResponse) Reset() { *m = InspectResponse{} } +func (m *InspectResponse) String() string { return proto.CompactTextString(m) } +func (*InspectResponse) ProtoMessage() {} +func (*InspectResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7f10298fa1d90f, []int{8} +} +func (m *InspectResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InspectResponse.Unmarshal(m, b) +} +func (m *InspectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InspectResponse.Marshal(b, m, deterministic) +} +func (m *InspectResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InspectResponse.Merge(m, src) +} +func (m *InspectResponse) XXX_Size() int { + return xxx_messageInfo_InspectResponse.Size(m) +} +func (m *InspectResponse) XXX_DiscardUnknown() { + xxx_messageInfo_InspectResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_InspectResponse proto.InternalMessageInfo + +func (m *InspectResponse) GetOptions() *BuildOptions { + if m != nil { + return m.Options + } + return nil +} + type UlimitOpt struct { Values map[string]*Ulimit `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -550,7 +626,7 @@ func (m *UlimitOpt) Reset() { *m = UlimitOpt{} } func (m *UlimitOpt) String() string { return proto.CompactTextString(m) } func (*UlimitOpt) ProtoMessage() {} func (*UlimitOpt) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{7} + return fileDescriptor_ed7f10298fa1d90f, []int{9} } func (m *UlimitOpt) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UlimitOpt.Unmarshal(m, b) @@ -590,7 +666,7 @@ func (m *Ulimit) Reset() { *m = Ulimit{} } func (m *Ulimit) String() string { return proto.CompactTextString(m) } func (*Ulimit) ProtoMessage() {} func (*Ulimit) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{8} + return fileDescriptor_ed7f10298fa1d90f, []int{10} } func (m *Ulimit) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Ulimit.Unmarshal(m, b) @@ -648,7 +724,7 @@ func (m *CommonOptions) Reset() { *m = CommonOptions{} } func (m *CommonOptions) String() string { return proto.CompactTextString(m) } func (*CommonOptions) ProtoMessage() {} func (*CommonOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{9} + return fileDescriptor_ed7f10298fa1d90f, []int{11} } func (m *CommonOptions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonOptions.Unmarshal(m, b) @@ -721,7 +797,7 @@ func (m *BuildResponse) Reset() { *m = BuildResponse{} } func (m *BuildResponse) String() string { return proto.CompactTextString(m) } func (*BuildResponse) ProtoMessage() {} func (*BuildResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{10} + return fileDescriptor_ed7f10298fa1d90f, []int{12} } func (m *BuildResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BuildResponse.Unmarshal(m, b) @@ -759,7 +835,7 @@ func (m *DisconnectRequest) Reset() { *m = DisconnectRequest{} } func (m *DisconnectRequest) String() string { return proto.CompactTextString(m) } func (*DisconnectRequest) ProtoMessage() {} func (*DisconnectRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{11} + return fileDescriptor_ed7f10298fa1d90f, []int{13} } func (m *DisconnectRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DisconnectRequest.Unmarshal(m, b) @@ -796,7 +872,7 @@ func (m *DisconnectResponse) Reset() { *m = DisconnectResponse{} } func (m *DisconnectResponse) String() string { return proto.CompactTextString(m) } func (*DisconnectResponse) ProtoMessage() {} func (*DisconnectResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{12} + return fileDescriptor_ed7f10298fa1d90f, []int{14} } func (m *DisconnectResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DisconnectResponse.Unmarshal(m, b) @@ -827,7 +903,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} } func (m *ListRequest) String() string { return proto.CompactTextString(m) } func (*ListRequest) ProtoMessage() {} func (*ListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{13} + return fileDescriptor_ed7f10298fa1d90f, []int{15} } func (m *ListRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListRequest.Unmarshal(m, b) @@ -865,7 +941,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} } func (m *ListResponse) String() string { return proto.CompactTextString(m) } func (*ListResponse) ProtoMessage() {} func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{14} + return fileDescriptor_ed7f10298fa1d90f, []int{16} } func (m *ListResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListResponse.Unmarshal(m, b) @@ -906,7 +982,7 @@ func (m *InputMessage) Reset() { *m = InputMessage{} } func (m *InputMessage) String() string { return proto.CompactTextString(m) } func (*InputMessage) ProtoMessage() {} func (*InputMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{15} + return fileDescriptor_ed7f10298fa1d90f, []int{17} } func (m *InputMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InputMessage.Unmarshal(m, b) @@ -980,7 +1056,7 @@ func (m *InputInitMessage) Reset() { *m = InputInitMessage{} } func (m *InputInitMessage) String() string { return proto.CompactTextString(m) } func (*InputInitMessage) ProtoMessage() {} func (*InputInitMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{16} + return fileDescriptor_ed7f10298fa1d90f, []int{18} } func (m *InputInitMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InputInitMessage.Unmarshal(m, b) @@ -1019,7 +1095,7 @@ func (m *DataMessage) Reset() { *m = DataMessage{} } func (m *DataMessage) String() string { return proto.CompactTextString(m) } func (*DataMessage) ProtoMessage() {} func (*DataMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{17} + return fileDescriptor_ed7f10298fa1d90f, []int{19} } func (m *DataMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DataMessage.Unmarshal(m, b) @@ -1063,7 +1139,7 @@ func (m *InputResponse) Reset() { *m = InputResponse{} } func (m *InputResponse) String() string { return proto.CompactTextString(m) } func (*InputResponse) ProtoMessage() {} func (*InputResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{18} + return fileDescriptor_ed7f10298fa1d90f, []int{20} } func (m *InputResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InputResponse.Unmarshal(m, b) @@ -1099,7 +1175,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{19} + return fileDescriptor_ed7f10298fa1d90f, []int{21} } func (m *Message) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Message.Unmarshal(m, b) @@ -1198,7 +1274,7 @@ func (m *InitMessage) Reset() { *m = InitMessage{} } func (m *InitMessage) String() string { return proto.CompactTextString(m) } func (*InitMessage) ProtoMessage() {} func (*InitMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{20} + return fileDescriptor_ed7f10298fa1d90f, []int{22} } func (m *InitMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InitMessage.Unmarshal(m, b) @@ -1241,6 +1317,7 @@ type ContainerConfig struct { Cwd string `protobuf:"bytes,6,opt,name=Cwd,proto3" json:"Cwd,omitempty"` NoCwd bool `protobuf:"varint,7,opt,name=NoCwd,proto3" json:"NoCwd,omitempty"` Tty bool `protobuf:"varint,8,opt,name=Tty,proto3" json:"Tty,omitempty"` + Initial bool `protobuf:"varint,9,opt,name=Initial,proto3" json:"Initial,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1250,7 +1327,7 @@ func (m *ContainerConfig) Reset() { *m = ContainerConfig{} } func (m *ContainerConfig) String() string { return proto.CompactTextString(m) } func (*ContainerConfig) ProtoMessage() {} func (*ContainerConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{21} + return fileDescriptor_ed7f10298fa1d90f, []int{23} } func (m *ContainerConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ContainerConfig.Unmarshal(m, b) @@ -1326,6 +1403,13 @@ func (m *ContainerConfig) GetTty() bool { return false } +func (m *ContainerConfig) GetInitial() bool { + if m != nil { + return m.Initial + } + return false +} + type FdMessage struct { Fd uint32 `protobuf:"varint,1,opt,name=Fd,proto3" json:"Fd,omitempty"` EOF bool `protobuf:"varint,2,opt,name=EOF,proto3" json:"EOF,omitempty"` @@ -1339,7 +1423,7 @@ func (m *FdMessage) Reset() { *m = FdMessage{} } func (m *FdMessage) String() string { return proto.CompactTextString(m) } func (*FdMessage) ProtoMessage() {} func (*FdMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{22} + return fileDescriptor_ed7f10298fa1d90f, []int{24} } func (m *FdMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FdMessage.Unmarshal(m, b) @@ -1392,7 +1476,7 @@ func (m *ResizeMessage) Reset() { *m = ResizeMessage{} } func (m *ResizeMessage) String() string { return proto.CompactTextString(m) } func (*ResizeMessage) ProtoMessage() {} func (*ResizeMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{23} + return fileDescriptor_ed7f10298fa1d90f, []int{25} } func (m *ResizeMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResizeMessage.Unmarshal(m, b) @@ -1439,7 +1523,7 @@ func (m *SignalMessage) Reset() { *m = SignalMessage{} } func (m *SignalMessage) String() string { return proto.CompactTextString(m) } func (*SignalMessage) ProtoMessage() {} func (*SignalMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{24} + return fileDescriptor_ed7f10298fa1d90f, []int{26} } func (m *SignalMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalMessage.Unmarshal(m, b) @@ -1477,7 +1561,7 @@ func (m *StatusRequest) Reset() { *m = StatusRequest{} } func (m *StatusRequest) String() string { return proto.CompactTextString(m) } func (*StatusRequest) ProtoMessage() {} func (*StatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{25} + return fileDescriptor_ed7f10298fa1d90f, []int{27} } func (m *StatusRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StatusRequest.Unmarshal(m, b) @@ -1518,7 +1602,7 @@ func (m *StatusResponse) Reset() { *m = StatusResponse{} } func (m *StatusResponse) String() string { return proto.CompactTextString(m) } func (*StatusResponse) ProtoMessage() {} func (*StatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{26} + return fileDescriptor_ed7f10298fa1d90f, []int{28} } func (m *StatusResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StatusResponse.Unmarshal(m, b) @@ -1576,7 +1660,7 @@ func (m *InfoRequest) Reset() { *m = InfoRequest{} } func (m *InfoRequest) String() string { return proto.CompactTextString(m) } func (*InfoRequest) ProtoMessage() {} func (*InfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{27} + return fileDescriptor_ed7f10298fa1d90f, []int{29} } func (m *InfoRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InfoRequest.Unmarshal(m, b) @@ -1607,7 +1691,7 @@ func (m *InfoResponse) Reset() { *m = InfoResponse{} } func (m *InfoResponse) String() string { return proto.CompactTextString(m) } func (*InfoResponse) ProtoMessage() {} func (*InfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{28} + return fileDescriptor_ed7f10298fa1d90f, []int{30} } func (m *InfoResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InfoResponse.Unmarshal(m, b) @@ -1647,7 +1731,7 @@ func (m *BuildxVersion) Reset() { *m = BuildxVersion{} } func (m *BuildxVersion) String() string { return proto.CompactTextString(m) } func (*BuildxVersion) ProtoMessage() {} func (*BuildxVersion) Descriptor() ([]byte, []int) { - return fileDescriptor_ed7f10298fa1d90f, []int{29} + return fileDescriptor_ed7f10298fa1d90f, []int{31} } func (m *BuildxVersion) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BuildxVersion.Unmarshal(m, b) @@ -1701,6 +1785,8 @@ func init() { proto.RegisterType((*Attest)(nil), "buildx.controller.v1.Attest") proto.RegisterType((*SSH)(nil), "buildx.controller.v1.SSH") proto.RegisterType((*Secret)(nil), "buildx.controller.v1.Secret") + proto.RegisterType((*InspectRequest)(nil), "buildx.controller.v1.InspectRequest") + proto.RegisterType((*InspectResponse)(nil), "buildx.controller.v1.InspectResponse") proto.RegisterType((*UlimitOpt)(nil), "buildx.controller.v1.UlimitOpt") proto.RegisterMapType((map[string]*Ulimit)(nil), "buildx.controller.v1.UlimitOpt.ValuesEntry") proto.RegisterType((*Ulimit)(nil), "buildx.controller.v1.Ulimit") @@ -1731,111 +1817,114 @@ func init() { func init() { proto.RegisterFile("controller.proto", fileDescriptor_ed7f10298fa1d90f) } var fileDescriptor_ed7f10298fa1d90f = []byte{ - // 1657 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xdd, 0x6e, 0xdb, 0xc6, - 0x12, 0x3e, 0x94, 0x64, 0xfd, 0x8c, 0x2c, 0xc7, 0xd9, 0xe3, 0x04, 0x3c, 0x3a, 0x39, 0x89, 0xc3, - 0xfc, 0x1c, 0x01, 0x29, 0xe4, 0xc4, 0x69, 0x9a, 0xdf, 0x02, 0xb5, 0x25, 0x0b, 0x76, 0xe1, 0x3f, - 0x50, 0x4e, 0x82, 0xb6, 0x40, 0x03, 0x5a, 0x5a, 0xcb, 0x84, 0x28, 0xae, 0xca, 0x5d, 0xc9, 0x56, - 0xaf, 0x7a, 0xd3, 0xdb, 0xbe, 0x47, 0xd1, 0x47, 0xe8, 0x55, 0xdf, 0xa1, 0x0f, 0xd2, 0x47, 0x28, - 0x76, 0x76, 0x49, 0x51, 0x96, 0x28, 0xdb, 0xe8, 0x95, 0x77, 0x86, 0xdf, 0x37, 0xb3, 0x3b, 0x3b, - 0x3f, 0x2b, 0xc3, 0x72, 0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 0xde, 0x96, 0x2f, 0x82, 0x91, - 0x3d, 0x69, 0x8b, 0xac, 0xc0, 0xc2, 0x86, 0xe7, 0xb1, 0x33, 0x73, 0x61, 0x35, 0x5d, 0x29, 0xd8, - 0x4a, 0x20, 0x5f, 0x40, 0x6e, 0x43, 0x08, 0xca, 0x05, 0x37, 0xb3, 0xe8, 0xec, 0xce, 0x6c, 0x67, - 0x0a, 0x64, 0x87, 0x60, 0x72, 0x00, 0x05, 0xf4, 0xbf, 0x11, 0x74, 0xb8, 0x99, 0x43, 0xe6, 0xb3, - 0x2b, 0x6c, 0x33, 0xe2, 0xa8, 0x2d, 0x8e, 0x6d, 0x90, 0x2d, 0x28, 0xd4, 0x9c, 0xd6, 0x29, 0x6d, - 0x04, 0xac, 0x67, 0xe6, 0xd1, 0xe0, 0xff, 0x67, 0x1b, 0x44, 0x98, 0x36, 0xa8, 0xcd, 0x44, 0x4c, - 0xb2, 0x01, 0x39, 0x14, 0x8e, 0x98, 0x59, 0xb8, 0x9e, 0x91, 0x90, 0x47, 0x2c, 0x58, 0xac, 0x75, - 0x02, 0x36, 0xe8, 0x1f, 0x3a, 0x01, 0xf5, 0x85, 0x09, 0x78, 0x4d, 0x13, 0x3a, 0xf2, 0x16, 0x72, - 0x5b, 0xe7, 0x7d, 0x16, 0x08, 0x6e, 0x16, 0xd1, 0xcd, 0xfd, 0xd9, 0x6e, 0x14, 0x48, 0x3b, 0xd0, - 0x0c, 0x72, 0x17, 0x60, 0xeb, 0x5c, 0x04, 0xce, 0x36, 0x93, 0x61, 0x5f, 0xc4, 0xeb, 0x88, 0x69, - 0x48, 0x03, 0xb2, 0xbb, 0xce, 0x31, 0xf5, 0xb8, 0x59, 0x42, 0xdb, 0xd5, 0x2b, 0x04, 0x56, 0x11, - 0x94, 0x23, 0xcd, 0x96, 0x69, 0xbb, 0x4f, 0xc5, 0x19, 0x0b, 0xba, 0x7b, 0xac, 0x4d, 0xcd, 0x25, - 0x95, 0xb6, 0x31, 0x15, 0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0x06, 0xf9, 0x1a, 0xb2, 0x3b, 0xfe, - 0x90, 0x75, 0x29, 0xf9, 0xdf, 0x6c, 0x42, 0x68, 0x6f, 0xfe, 0xe7, 0x8a, 0xf1, 0xd4, 0x20, 0x7b, - 0x90, 0x91, 0xd3, 0x92, 0x24, 0xb4, 0xfe, 0xd8, 0xa8, 0x2d, 0x5b, 0xf3, 0x20, 0x3a, 0x8a, 0x9f, - 0x00, 0xc6, 0x33, 0x9b, 0x24, 0xfc, 0x90, 0x9f, 0x1a, 0xfe, 0xe5, 0xca, 0xe5, 0x40, 0xed, 0x60, - 0x4f, 0x0e, 0xac, 0x13, 0x46, 0x12, 0x47, 0x55, 0x94, 0xee, 0x65, 0x6b, 0x1e, 0x44, 0x99, 0xdb, - 0xcc, 0x7c, 0x9b, 0xea, 0x1f, 0x1f, 0x67, 0xf1, 0x9f, 0x54, 0xcf, 0xff, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0xf4, 0x2e, 0xaa, 0xc4, 0x0b, 0x13, 0x00, 0x00, + // 1709 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xdd, 0x6e, 0xdb, 0xc8, + 0x15, 0x2e, 0x25, 0x59, 0x3f, 0x47, 0x96, 0xed, 0x4c, 0x9d, 0x80, 0x55, 0xd3, 0xc4, 0x61, 0x9c, + 0x54, 0x40, 0x0a, 0x39, 0x71, 0x9a, 0xe6, 0xb7, 0x40, 0x6d, 0xc9, 0x82, 0x5d, 0xf8, 0x0f, 0x94, + 0xe3, 0xa0, 0x2d, 0xd0, 0x80, 0x96, 0xc6, 0x32, 0x21, 0x8a, 0xa3, 0x72, 0x46, 0xb2, 0xd5, 0xab, + 0xde, 0xf4, 0x76, 0xdf, 0x63, 0xb1, 0xfb, 0x06, 0x7b, 0xb5, 0x0f, 0xb1, 0xef, 0xb1, 0x8f, 0xb0, + 0x98, 0x33, 0x43, 0x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x68, 0xbf, 0xf9, 0xfd, 0x02, 0x40, 0x2d, 0x3a, 0x0f, 0x39, 0x86, 0x05, 0xb4, 0x47, 0xac, + 0xb9, 0x73, 0x0f, 0xef, 0x5d, 0x7e, 0x7a, 0x8b, 0xd9, 0x48, 0x4e, 0x65, 0xf2, 0xe3, 0x6b, 0x8b, + 0xac, 0x27, 0x35, 0xc8, 0xf8, 0x83, 0xad, 0xfc, 0xec, 0x06, 0x94, 0xd6, 0xfb, 0x19, 0xb2, 0x2a, + 0x0b, 0x48, 0x52, 0x1b, 0x8b, 0xe7, 0x6d, 0x79, 0x7d, 0x3e, 0x48, 0x29, 0x7d, 0x69, 0x10, 0x5b, + 0x37, 0xb9, 0x24, 0x07, 0xc4, 0xe7, 0x5e, 0x92, 0x03, 0x26, 0x06, 0x46, 0xc5, 0x20, 0x7f, 0x87, + 0xec, 0x9e, 0x3f, 0x64, 0x5d, 0x4a, 0xfe, 0x30, 0x9b, 0x10, 0xea, 0x9b, 0xff, 0xb9, 0x62, 0xbc, + 0x34, 0xc8, 0x01, 0x64, 0xe4, 0x7c, 0x26, 0x09, 0xc3, 0x26, 0x36, 0xdc, 0xcb, 0xd6, 0x3c, 0x88, + 0xf6, 0xe2, 0x57, 0x80, 0xf1, 0x2b, 0x81, 0x24, 0xfc, 0xbf, 0x62, 0xea, 0xb9, 0x51, 0xae, 0xdc, + 0x0c, 0xd4, 0x06, 0x0e, 0xe4, 0x88, 0x3c, 0x67, 0x24, 0x71, 0x38, 0x46, 0x65, 0x54, 0xb6, 0xe6, + 0x41, 0x94, 0xba, 0xed, 0xcc, 0x3f, 0x53, 0xfd, 0xb3, 0xb3, 0x2c, 0xfe, 0x2f, 0xee, 0xf5, 0x2f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xeb, 0x06, 0xf5, 0xf2, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1851,6 +1940,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ControllerClient interface { Build(ctx context.Context, in *BuildRequest, opts ...grpc.CallOption) (*BuildResponse, error) + Inspect(ctx context.Context, in *InspectRequest, opts ...grpc.CallOption) (*InspectResponse, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (Controller_StatusClient, error) Input(ctx context.Context, opts ...grpc.CallOption) (Controller_InputClient, error) Invoke(ctx context.Context, opts ...grpc.CallOption) (Controller_InvokeClient, error) @@ -1876,6 +1966,15 @@ func (c *controllerClient) Build(ctx context.Context, in *BuildRequest, opts ... return out, nil } +func (c *controllerClient) Inspect(ctx context.Context, in *InspectRequest, opts ...grpc.CallOption) (*InspectResponse, error) { + out := new(InspectResponse) + err := c.cc.Invoke(ctx, "/buildx.controller.v1.Controller/Inspect", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *controllerClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (Controller_StatusClient, error) { stream, err := c.cc.NewStream(ctx, &_Controller_serviceDesc.Streams[0], "/buildx.controller.v1.Controller/Status", opts...) if err != nil { @@ -2003,6 +2102,7 @@ func (c *controllerClient) Info(ctx context.Context, in *InfoRequest, opts ...gr // ControllerServer is the server API for Controller service. type ControllerServer interface { Build(context.Context, *BuildRequest) (*BuildResponse, error) + Inspect(context.Context, *InspectRequest) (*InspectResponse, error) Status(*StatusRequest, Controller_StatusServer) error Input(Controller_InputServer) error Invoke(Controller_InvokeServer) error @@ -2018,6 +2118,9 @@ type UnimplementedControllerServer struct { func (*UnimplementedControllerServer) Build(ctx context.Context, req *BuildRequest) (*BuildResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Build not implemented") } +func (*UnimplementedControllerServer) Inspect(ctx context.Context, req *InspectRequest) (*InspectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Inspect not implemented") +} func (*UnimplementedControllerServer) Status(req *StatusRequest, srv Controller_StatusServer) error { return status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -2059,6 +2162,24 @@ func _Controller_Build_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Controller_Inspect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InspectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Inspect(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/buildx.controller.v1.Controller/Inspect", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Inspect(ctx, req.(*InspectRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Controller_Status_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(StatusRequest) if err := stream.RecvMsg(m); err != nil { @@ -2194,6 +2315,10 @@ var _Controller_serviceDesc = grpc.ServiceDesc{ MethodName: "Build", Handler: _Controller_Build_Handler, }, + { + MethodName: "Inspect", + Handler: _Controller_Inspect_Handler, + }, { MethodName: "List", Handler: _Controller_List_Handler, diff --git a/controller/pb/controller.proto b/controller/pb/controller.proto index cd3807320261..a7ecc64bff80 100644 --- a/controller/pb/controller.proto +++ b/controller/pb/controller.proto @@ -8,6 +8,7 @@ option go_package = "pb"; service Controller { rpc Build(BuildRequest) returns (BuildResponse); + rpc Inspect(InspectRequest) returns (InspectResponse); rpc Status(StatusRequest) returns (stream StatusResponse); rpc Input(stream InputMessage) returns (InputResponse); rpc Invoke(stream Message) returns (stream Message); @@ -77,6 +78,14 @@ message Secret { string Env = 3; } +message InspectRequest { + string Ref = 1; +} + +message InspectResponse { + BuildOptions Options = 1; +} + message UlimitOpt { map values = 1; } @@ -161,6 +170,7 @@ message ContainerConfig { string Cwd = 6; bool NoCwd = 7; // Do not set cwd but use the image's default bool Tty = 8; + bool Initial = 9; // Run container from the initial state of that stage (supported only on the failed step) } message FdMessage { diff --git a/controller/remote/client.go b/controller/remote/client.go index 8898c7f079cb..8977408902e9 100644 --- a/controller/remote/client.go +++ b/controller/remote/client.go @@ -13,6 +13,7 @@ import ( "github.com/docker/buildx/util/progress" "github.com/moby/buildkit/client" "github.com/moby/buildkit/identity" + "github.com/moby/buildkit/util/grpcerrors" "github.com/pkg/errors" "golang.org/x/sync/errgroup" "google.golang.org/grpc" @@ -33,6 +34,8 @@ func NewClient(ctx context.Context, addr string) (*Client, error) { grpc.WithContextDialer(dialer.ContextDialer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)), grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaults.DefaultMaxSendMsgSize)), + grpc.WithUnaryInterceptor(grpcerrors.UnaryClientInterceptor), + grpc.WithStreamInterceptor(grpcerrors.StreamClientInterceptor), } conn, err := grpc.DialContext(ctx, dialer.DialAddress(addr), gopts...) if err != nil { @@ -71,6 +74,9 @@ func (c *Client) List(ctx context.Context) (keys []string, retErr error) { } func (c *Client) Disconnect(ctx context.Context, key string) error { + if key == "" { + return nil + } _, err := c.client().Disconnect(ctx, &pb.DisconnectRequest{Ref: key}) return err } @@ -91,6 +97,10 @@ func (c *Client) Invoke(ctx context.Context, ref string, containerConfig pb.Cont }) } +func (c *Client) Inspect(ctx context.Context, ref string) (*pb.InspectResponse, error) { + return c.client().Inspect(ctx, &pb.InspectRequest{Ref: ref}) +} + func (c *Client) Build(ctx context.Context, options pb.BuildOptions, in io.ReadCloser, w io.Writer, out console.File, progressMode string) (string, *client.SolveResponse, error) { ref := identity.NewID() pw, err := progress.NewPrinter(context.TODO(), w, out, progressMode) diff --git a/controller/remote/controller.go b/controller/remote/controller.go index 97508992d6aa..d06687695266 100644 --- a/controller/remote/controller.go +++ b/controller/remote/controller.go @@ -24,6 +24,7 @@ import ( "github.com/docker/buildx/version" "github.com/docker/cli/cli/command" "github.com/moby/buildkit/client" + "github.com/moby/buildkit/util/grpcerrors" "github.com/pelletier/go-toml" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -161,7 +162,10 @@ func serveCmd(dockerCli command.Cli) *cobra.Command { if err != nil { return err } - rpc := grpc.NewServer() + rpc := grpc.NewServer( + grpc.UnaryInterceptor(grpcerrors.UnaryServerInterceptor), + grpc.StreamInterceptor(grpcerrors.StreamServerInterceptor), + ) controllerapi.RegisterControllerServer(rpc, b) doneCh := make(chan struct{}) errCh := make(chan error, 1) diff --git a/controller/remote/server.go b/controller/remote/server.go index 072b5225a6b2..376db1fc4071 100644 --- a/controller/remote/server.go +++ b/controller/remote/server.go @@ -7,6 +7,8 @@ import ( "time" "github.com/docker/buildx/build" + cbuild "github.com/docker/buildx/controller/build" + controllererrors "github.com/docker/buildx/controller/errdefs" "github.com/docker/buildx/controller/pb" "github.com/docker/buildx/util/ioset" "github.com/docker/buildx/version" @@ -34,6 +36,7 @@ type Server struct { type session struct { statusChan chan *client.SolveStatus result *build.ResultContext + buildOptions *pb.BuildOptions inputPipe *io.PipeWriter curInvokeCancel func() curBuildCancel func() @@ -81,6 +84,9 @@ func (m *Server) Disconnect(ctx context.Context, req *pb.DisconnectRequest) (res if s.curInvokeCancel != nil { s.curInvokeCancel() } + if s.result != nil { + s.result.Done() + } } delete(m.session, key) m.sessionMu.Unlock() @@ -104,6 +110,23 @@ func (m *Server) Close() error { return nil } +func (m *Server) Inspect(ctx context.Context, req *pb.InspectRequest) (*pb.InspectResponse, error) { + ref := req.Ref + if ref == "" { + return nil, errors.New("inspect: empty key") + } + var bo *pb.BuildOptions + m.sessionMu.Lock() + if s, ok := m.session[ref]; ok { + bo = s.buildOptions + } else { + m.sessionMu.Unlock() + return nil, errors.Errorf("inspect: unknown key %v", ref) + } + m.sessionMu.Unlock() + return &pb.InspectResponse{Options: bo}, nil +} + func (m *Server) Build(ctx context.Context, req *pb.BuildRequest) (*pb.BuildResponse, error) { ref := req.Ref if ref == "" { @@ -150,24 +173,40 @@ func (m *Server) Build(ctx context.Context, req *pb.BuildRequest) (*pb.BuildResp // Build the specified request ctx, cancel := context.WithCancel(ctx) defer cancel() - resp, res, err := m.buildFunc(ctx, req.Options, inR, statusChan) + resp, res, buildErr := m.buildFunc(ctx, req.Options, inR, statusChan) m.sessionMu.Lock() if s, ok := m.session[ref]; ok { - s.result = res - s.curBuildCancel = cancel - m.session[ref] = s + if buildErr != nil { + var re *cbuild.ResultContextError + if errors.As(buildErr, &re) && re.ResultContext != nil { + res = re.ResultContext + } + } + if res != nil { + s.result = res + s.curBuildCancel = cancel + s.buildOptions = req.Options + m.session[ref] = s + if buildErr != nil { + buildErr = controllererrors.WrapBuild(buildErr, ref) + } + } } else { m.sessionMu.Unlock() return nil, errors.Errorf("build: unknown key %v", ref) } m.sessionMu.Unlock() + if buildErr != nil { + return nil, buildErr + } + if resp == nil { resp = &client.SolveResponse{} } return &pb.BuildResponse{ ExporterResponse: resp.ExporterResponse, - }, err + }, nil } func (m *Server) Status(req *pb.StatusRequest, stream pb.Controller_StatusServer) error { @@ -379,6 +418,7 @@ func (m *Server) Invoke(srv pb.Controller_InvokeServer) error { Stdin: containerIn.Stdin, Stdout: containerIn.Stdout, Stderr: containerIn.Stderr, + Initial: cfg.Initial, } if !cfg.NoUser { ccfg.User = &cfg.User diff --git a/docs/reference/buildx.md b/docs/reference/buildx.md index 9ce6fa83690b..735912b9ba14 100644 --- a/docs/reference/buildx.md +++ b/docs/reference/buildx.md @@ -15,6 +15,7 @@ Extended build capabilities with BuildKit | [`bake`](buildx_bake.md) | Build from a file | | [`build`](buildx_build.md) | Start a build | | [`create`](buildx_create.md) | Create a new builder instance | +| [`debug-shell`](buildx_debug-shell.md) | Start a monitor | | [`du`](buildx_du.md) | Disk usage | | [`imagetools`](buildx_imagetools.md) | Commands to work on images in registry | | [`inspect`](buildx_inspect.md) | Inspect current builder instance | diff --git a/docs/reference/buildx_debug-shell.md b/docs/reference/buildx_debug-shell.md new file mode 100644 index 000000000000..35a1f26eecfa --- /dev/null +++ b/docs/reference/buildx_debug-shell.md @@ -0,0 +1,18 @@ +# docker buildx debug-shell + + +Start a monitor + +### Options + +| Name | Type | Default | Description | +|:------------------|:---------|:--------|:-----------------------------------------------------------------------------------------| +| `--builder` | `string` | | Override the configured builder instance | +| `--detach` | | | Detach buildx server (supported only on linux) [experimental] | +| `--progress` | `string` | `auto` | Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output | +| `--root` | `string` | | Specify root directory of server to connect [experimental] | +| `--server-config` | `string` | | Specify buildx server config file (used only when launching new server) [experimental] | + + + + diff --git a/go.mod b/go.mod index 29678b6126fc..2a8574fd64d1 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/compose-spec/compose-go v1.9.0 github.com/containerd/console v1.0.3 github.com/containerd/containerd v1.7.0-beta.3 + github.com/containerd/typeurl v1.0.3-0.20220422153119-7f6e6d160d67 github.com/docker/cli v23.0.0+incompatible github.com/docker/cli-docs-tool v0.5.1 github.com/docker/distribution v2.8.1+incompatible @@ -79,7 +80,6 @@ require ( github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/containerd/ttrpc v1.1.1-0.20220420014843-944ef4a40df3 // indirect - github.com/containerd/typeurl v1.0.3-0.20220422153119-7f6e6d160d67 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/distribution/distribution/v3 v3.0.0-20221103125252-ebfa2a0ac0a9 // indirect diff --git a/monitor/monitor.go b/monitor/monitor.go index 0e2b62cb50ed..64b1b80d391b 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -11,8 +11,10 @@ import ( "github.com/containerd/console" "github.com/docker/buildx/controller/control" + controllererrors "github.com/docker/buildx/controller/errdefs" controllerapi "github.com/docker/buildx/controller/pb" "github.com/docker/buildx/util/ioset" + "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/term" ) @@ -30,7 +32,7 @@ Available commands are: ` // RunMonitor provides an interactive session for running and managing containers via specified IO. -func RunMonitor(ctx context.Context, curRef string, options controllerapi.BuildOptions, invokeConfig controllerapi.ContainerConfig, c control.BuildxController, progressMode string, stdin io.ReadCloser, stdout io.WriteCloser, stderr console.File) error { +func RunMonitor(ctx context.Context, curRef string, options *controllerapi.BuildOptions, invokeConfig controllerapi.ContainerConfig, c control.BuildxController, progressMode string, stdin io.ReadCloser, stdout io.WriteCloser, stderr console.File) error { defer func() { if err := c.Disconnect(ctx, curRef); err != nil { logrus.Warnf("disconnect error: %v", err) @@ -74,14 +76,15 @@ func RunMonitor(ctx context.Context, curRef string, options controllerapi.BuildO } return "Switched IO\n" }), - invokeFunc: func(ctx context.Context, ref string, in io.ReadCloser, out io.WriteCloser, err io.WriteCloser) error { + invokeFunc: func(ctx context.Context, ref string, init bool, in io.ReadCloser, out io.WriteCloser, err io.WriteCloser) error { + invokeConfig.Initial = init return c.Invoke(ctx, ref, invokeConfig, in, out, err) }, } // Start container automatically fmt.Fprintf(stdout, "Launching interactive container. Press Ctrl-a-c to switch to monitor console\n") - m.rollback(ctx, curRef) + m.rollback(ctx, curRef, false) // Serve monitor commands monitorForwarder := ioset.NewForwarder() @@ -116,22 +119,52 @@ func RunMonitor(ctx context.Context, curRef string, options controllerapi.BuildO case "": // nop case "reload": + var bo *controllerapi.BuildOptions + if curRef != "" { + // Rebuilding an existing session; Restore the build option used for building this session. + res, err := c.Inspect(ctx, curRef) + if err != nil { + fmt.Printf("failed to inspect the current build session: %v\n", err) + } else { + bo = res.Options + } + } else { + bo = options + } + if bo == nil { + fmt.Println("reload: no build option is provided") + continue + } if curRef != "" { if err := c.Disconnect(ctx, curRef); err != nil { fmt.Println("disconnect error", err) } } - ref, _, err := c.Build(ctx, options, nil, stdout, stderr, progressMode) // TODO: support stdin, hold build ref + var resultUpdated bool + ref, _, err := c.Build(ctx, *bo, nil, stdout, stderr, progressMode) // TODO: support stdin, hold build ref if err != nil { - fmt.Printf("failed to reload: %v\n", err) + var be *controllererrors.BuildError + if errors.As(err, &be) { + curRef = be.Ref + resultUpdated = true + } else { + fmt.Printf("failed to reload: %v\n", err) + } } else { curRef = ref + resultUpdated = true + } + if resultUpdated { // rollback the running container with the new result - m.rollback(ctx, curRef) + m.rollback(ctx, curRef, false) fmt.Fprint(stdout, "Interactive container was restarted. Press Ctrl-a-c to switch to the new container\n") } case "rollback": - m.rollback(ctx, curRef) + init := false + if len(args) >= 2 && args[1] == "init" { + init = true + } + m.rollback(ctx, curRef, init) fmt.Fprint(stdout, "Interactive container was restarted. Press Ctrl-a-c to switch to the new container\n") case "list": refs, err := c.List(ctx) @@ -163,7 +196,7 @@ func RunMonitor(ctx context.Context, curRef string, options controllerapi.BuildO continue } ref := args[1] - m.rollback(ctx, ref) + m.rollback(ctx, ref, false) curRef = ref case "exit": return @@ -200,25 +233,28 @@ type readWriter struct { type monitor struct { muxIO *ioset.MuxIO invokeIO *ioset.Forwarder - invokeFunc func(context.Context, string, io.ReadCloser, io.WriteCloser, io.WriteCloser) error + invokeFunc func(context.Context, string, bool, io.ReadCloser, io.WriteCloser, io.WriteCloser) error curInvokeCancel func() } -func (m *monitor) rollback(ctx context.Context, ref string) { +func (m *monitor) rollback(ctx context.Context, ref string, init bool) { if m.curInvokeCancel != nil { m.curInvokeCancel() // Finish the running container if exists } go func() { // Start a new container - if err := m.invoke(ctx, ref); err != nil { + if err := m.invoke(ctx, ref, init); err != nil { logrus.Debugf("invoke error: %v", err) } }() } -func (m *monitor) invoke(ctx context.Context, ref string) error { +func (m *monitor) invoke(ctx context.Context, ref string, init bool) error { m.muxIO.Enable(1) defer m.muxIO.Disable(1) + if ref == "" { + return nil + } invokeCtx, invokeCancel := context.WithCancel(ctx) containerIn, containerOut := ioset.Pipe() @@ -236,7 +272,7 @@ func (m *monitor) invoke(ctx context.Context, ref string) error { defer curInvokeCancel() m.curInvokeCancel = curInvokeCancel - err := m.invokeFunc(invokeCtx, ref, containerIn.Stdin, containerIn.Stdout, containerIn.Stderr) + err := m.invokeFunc(invokeCtx, ref, init, containerIn.Stdin, containerIn.Stdout, containerIn.Stderr) close(waitInvokeDoneCh) return err