diff --git a/build/result.go b/build/result.go index 3cf531de..3bef7e18 100644 --- a/build/result.go +++ b/build/result.go @@ -8,6 +8,7 @@ import ( "sync" controllerapi "github.com/docker/buildx/controller/pb" + "github.com/docker/buildx/util/progress" "github.com/moby/buildkit/client" "github.com/moby/buildkit/exporter/containerimage/exptypes" gateway "github.com/moby/buildkit/frontend/gateway/client" @@ -93,6 +94,8 @@ func NewResultHandle(ctx context.Context, cc *client.Client, opt client.SolveOpt if res != nil && err == nil { if noEval { respHandle = &ResultHandle{ + client: cc, + solveOpt: opt, done: make(chan struct{}), gwClient: c, gwCtx: ctx, @@ -127,6 +130,8 @@ func NewResultHandle(ctx context.Context, cc *client.Client, opt client.SolveOpt var se *errdefs.SolveError if errors.As(err, &se) { respHandle = &ResultHandle{ + client: cc, + solveOpt: opt, done: make(chan struct{}), solveErr: se, gwClient: c, @@ -183,6 +188,8 @@ func NewResultHandle(ctx context.Context, cc *client.Client, opt client.SolveOpt return nil, errors.Wrap(err, "inconsistent solve result") } respHandle = &ResultHandle{ + client: cc, + solveOpt: opt, done: make(chan struct{}), res: res, gwClient: c, @@ -265,8 +272,27 @@ func evalDefinition(ctx context.Context, c gateway.Client, defs *result.Result[* return res, nil } +func SolveWithResultHandler(ctx context.Context, product string, resultCtx *ResultHandle, target *pb.Definition, pw progress.Writer) (*ResultHandle, error) { + opt := resultCtx.solveOpt + opt.Ref = "" + opt.Exports = nil + opt.CacheExports = nil + ch, done := progress.NewChannel(pw) + defer func() { <-done }() + h, _, err := NewResultHandle(ctx, resultCtx.client, opt, product, func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + return c.Solve(ctx, gateway.SolveRequest{ + Evaluate: true, + Definition: target, + }) + }, ch, false) + return h, err +} + // ResultHandle is a build result with the client that built it. type ResultHandle struct { + client *client.Client + solveOpt client.SolveOpt + res *gateway.Result solveErr *errdefs.SolveError @@ -295,6 +321,10 @@ func (r *ResultHandle) Done() { }) } +func (r *ResultHandle) SolveError() *errdefs.SolveError { + return r.solveErr +} + func (r *ResultHandle) registerCleanup(f func()) { r.cleanupsMu.Lock() r.cleanups = append(r.cleanups, f) diff --git a/controller/control/controller.go b/controller/control/controller.go index bdc5b7f8..ebb49ad4 100644 --- a/controller/control/controller.go +++ b/controller/control/controller.go @@ -7,6 +7,7 @@ import ( controllerapi "github.com/docker/buildx/controller/pb" "github.com/docker/buildx/util/progress" "github.com/moby/buildkit/client" + solverpb "github.com/moby/buildkit/solver/pb" ) type BuildxController interface { @@ -23,6 +24,7 @@ type BuildxController interface { ListProcesses(ctx context.Context, ref string) (infos []*controllerapi.ProcessInfo, retErr error) DisconnectProcess(ctx context.Context, ref, pid string) error Inspect(ctx context.Context, ref string) (*controllerapi.InspectResponse, error) + Solve(ctx context.Context, ref string, def *solverpb.Definition, progress progress.Writer) error } type ControlOptions struct { diff --git a/controller/local/controller.go b/controller/local/controller.go index fb1cd282..fea60068 100644 --- a/controller/local/controller.go +++ b/controller/local/controller.go @@ -15,6 +15,7 @@ import ( "github.com/docker/buildx/util/progress" "github.com/docker/cli/cli/command" "github.com/moby/buildkit/client" + solverpb "github.com/moby/buildkit/solver/pb" "github.com/pkg/errors" ) @@ -40,6 +41,8 @@ type localController struct { processes *processes.Manager buildOnGoing atomic.Bool + + originalResult *build.ResultHandle } func (b *localController) Build(ctx context.Context, options controllerapi.BuildOptions, in io.ReadCloser, progress progress.Writer) (string, *client.SolveResponse, error) { @@ -55,6 +58,7 @@ func (b *localController) Build(ctx context.Context, options controllerapi.Build resultCtx: res, buildOptions: &options, } + b.originalResult = res if buildErr != nil { buildErr = controllererrors.WrapBuild(buildErr, b.ref) } @@ -144,3 +148,20 @@ func (b *localController) Inspect(ctx context.Context, ref string) (*controllera } return &controllerapi.InspectResponse{Options: b.buildConfig.buildOptions}, nil } + +func (b *localController) Solve(ctx context.Context, ref string, target *solverpb.Definition, progress progress.Writer) error { + if ref != b.ref { + return errors.Errorf("unknown ref %q", ref) + } + if b.originalResult == nil { + return errors.Errorf("no build has been called") + } + res, err := build.SolveWithResultHandler(ctx, "buildx", b.originalResult, target, progress) + if err == nil { + b.buildConfig.resultCtx = res + if se := res.SolveError(); se != nil { + err = errors.Errorf("failed solve: %v", se) + } + } + return err +} diff --git a/controller/pb/controller.pb.go b/controller/pb/controller.pb.go index da8df559..74c450ee 100644 --- a/controller/pb/controller.pb.go +++ b/controller/pb/controller.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" proto "github.com/gogo/protobuf/proto" control "github.com/moby/buildkit/api/services/control" + pb1 "github.com/moby/buildkit/solver/pb" pb "github.com/moby/buildkit/sourcepolicy/pb" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -2004,6 +2005,82 @@ func (m *BuildxVersion) GetRevision() string { return "" } +type SolveRequest struct { + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + Target *pb1.Definition `protobuf:"bytes,2,opt,name=Target,proto3" json:"Target,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SolveRequest) Reset() { *m = SolveRequest{} } +func (m *SolveRequest) String() string { return proto.CompactTextString(m) } +func (*SolveRequest) ProtoMessage() {} +func (*SolveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7f10298fa1d90f, []int{37} +} +func (m *SolveRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SolveRequest.Unmarshal(m, b) +} +func (m *SolveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SolveRequest.Marshal(b, m, deterministic) +} +func (m *SolveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SolveRequest.Merge(m, src) +} +func (m *SolveRequest) XXX_Size() int { + return xxx_messageInfo_SolveRequest.Size(m) +} +func (m *SolveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SolveRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SolveRequest proto.InternalMessageInfo + +func (m *SolveRequest) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +func (m *SolveRequest) GetTarget() *pb1.Definition { + if m != nil { + return m.Target + } + return nil +} + +type SolveResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SolveResponse) Reset() { *m = SolveResponse{} } +func (m *SolveResponse) String() string { return proto.CompactTextString(m) } +func (*SolveResponse) ProtoMessage() {} +func (*SolveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7f10298fa1d90f, []int{38} +} +func (m *SolveResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SolveResponse.Unmarshal(m, b) +} +func (m *SolveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SolveResponse.Marshal(b, m, deterministic) +} +func (m *SolveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SolveResponse.Merge(m, src) +} +func (m *SolveResponse) XXX_Size() int { + return xxx_messageInfo_SolveResponse.Size(m) +} +func (m *SolveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SolveResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SolveResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*ListProcessesRequest)(nil), "buildx.controller.v1.ListProcessesRequest") proto.RegisterType((*ListProcessesResponse)(nil), "buildx.controller.v1.ListProcessesResponse") @@ -2049,131 +2126,137 @@ func init() { proto.RegisterType((*InfoRequest)(nil), "buildx.controller.v1.InfoRequest") proto.RegisterType((*InfoResponse)(nil), "buildx.controller.v1.InfoResponse") proto.RegisterType((*BuildxVersion)(nil), "buildx.controller.v1.BuildxVersion") + proto.RegisterType((*SolveRequest)(nil), "buildx.controller.v1.SolveRequest") + proto.RegisterType((*SolveResponse)(nil), "buildx.controller.v1.SolveResponse") } func init() { proto.RegisterFile("controller.proto", fileDescriptor_ed7f10298fa1d90f) } var fileDescriptor_ed7f10298fa1d90f = []byte{ - // 1895 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xef, 0x6e, 0x1b, 0xc7, - 0x11, 0xef, 0x89, 0x14, 0xff, 0x0c, 0x45, 0x59, 0xde, 0xca, 0xee, 0xfa, 0xec, 0xc4, 0xf2, 0xd9, - 0x4e, 0x89, 0xba, 0xa0, 0x12, 0xa5, 0xae, 0xe2, 0x38, 0x01, 0x2a, 0x51, 0x22, 0xa4, 0xc0, 0x96, - 0x84, 0xa5, 0xec, 0xa0, 0x2d, 0xd0, 0xe0, 0x48, 0xae, 0xa8, 0x83, 0x8e, 0xb7, 0xec, 0xed, 0x52, - 0x7f, 0xfa, 0xa9, 0x5f, 0xfa, 0xad, 0xe8, 0x7b, 0x14, 0x7d, 0x84, 0x7e, 0xea, 0x4b, 0xf4, 0x31, - 0x8a, 0x3e, 0x42, 0xb1, 0xb3, 0x7b, 0xe4, 0x51, 0xe4, 0x51, 0x52, 0xf3, 0x89, 0x3b, 0x73, 0xbf, - 0xdf, 0xec, 0xce, 0xdc, 0xec, 0xcc, 0x1c, 0x61, 0xa5, 0x23, 0x22, 0x15, 0x8b, 0x30, 0xe4, 0x71, - 0x7d, 0x10, 0x0b, 0x25, 0xc8, 0x6a, 0x7b, 0x18, 0x84, 0xdd, 0xcb, 0x7a, 0xea, 0xc1, 0xf9, 0x17, - 0xee, 0xdb, 0x5e, 0xa0, 0x4e, 0x87, 0xed, 0x7a, 0x47, 0xf4, 0xd7, 0xfb, 0xa2, 0x7d, 0xb5, 0x8e, - 0xa8, 0xb3, 0x40, 0xad, 0xfb, 0x83, 0x60, 0x5d, 0xf2, 0xf8, 0x3c, 0xe8, 0x70, 0xb9, 0x6e, 0x49, - 0xc9, 0xaf, 0x31, 0xe9, 0xbe, 0xce, 0x24, 0x4b, 0x31, 0x8c, 0x3b, 0x7c, 0x20, 0xc2, 0xa0, 0x73, - 0xb5, 0x3e, 0x68, 0xaf, 0x9b, 0x95, 0xa1, 0x79, 0x35, 0x58, 0x7d, 0x17, 0x48, 0x75, 0x14, 0x8b, - 0x0e, 0x97, 0x92, 0x4b, 0xc6, 0xff, 0x38, 0xe4, 0x52, 0x91, 0x15, 0xc8, 0x31, 0x7e, 0x42, 0x9d, - 0x35, 0xa7, 0x56, 0x66, 0x7a, 0xe9, 0x1d, 0xc1, 0x83, 0x6b, 0x48, 0x39, 0x10, 0x91, 0xe4, 0x64, - 0x13, 0x16, 0xf7, 0xa3, 0x13, 0x21, 0xa9, 0xb3, 0x96, 0xab, 0x55, 0x36, 0x9e, 0xd5, 0x67, 0x39, - 0x57, 0xb7, 0x3c, 0x8d, 0x64, 0x06, 0xef, 0x49, 0xa8, 0xa4, 0xb4, 0xe4, 0x09, 0x94, 0x13, 0x71, - 0xc7, 0x6e, 0x3c, 0x56, 0x90, 0x26, 0x2c, 0xed, 0x47, 0xe7, 0xe2, 0x8c, 0x37, 0x44, 0x74, 0x12, - 0xf4, 0xe8, 0xc2, 0x9a, 0x53, 0xab, 0x6c, 0x78, 0xb3, 0x37, 0x4b, 0x23, 0xd9, 0x04, 0xcf, 0xfb, - 0x0e, 0xe8, 0x4e, 0x20, 0x3b, 0x22, 0x8a, 0x78, 0x27, 0x71, 0x26, 0xd3, 0xe9, 0xc9, 0x33, 0x2d, - 0x5c, 0x3b, 0x93, 0xf7, 0x18, 0x1e, 0xcd, 0xb0, 0x65, 0xc2, 0xe2, 0xfd, 0x01, 0x96, 0xb6, 0xf5, - 0xd9, 0xb2, 0x8d, 0x7f, 0x03, 0xc5, 0xc3, 0x81, 0x0a, 0x44, 0x24, 0xe7, 0x7b, 0x83, 0x66, 0x2c, - 0x92, 0x25, 0x14, 0xef, 0xdf, 0x15, 0xbb, 0x81, 0x55, 0x90, 0x35, 0xa8, 0x34, 0x44, 0xa4, 0xf8, - 0xa5, 0x3a, 0xf2, 0xd5, 0xa9, 0xdd, 0x28, 0xad, 0x22, 0x9f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, 0x75, 0x47, 0x3d, 0x11, 0x24, 0xb3, 0x97, - 0x8e, 0xae, 0x91, 0xeb, 0xcd, 0x83, 0x58, 0x73, 0xa7, 0x50, 0x9d, 0xf8, 0xa7, 0x94, 0xfc, 0x22, - 0xdb, 0xc9, 0xeb, 0x7f, 0xbc, 0xba, 0xaf, 0x6e, 0x85, 0xb5, 0x3b, 0xa9, 0xf4, 0x54, 0x66, 0x1f, - 0x93, 0xfa, 0x4d, 0x7e, 0x4f, 0xfe, 0xeb, 0xe9, 0xae, 0xdf, 0x1a, 0x6f, 0x76, 0xdd, 0xce, 0xff, - 0x6e, 0x61, 0xd0, 0x6e, 0x17, 0xf0, 0x0f, 0xe4, 0x2f, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xec, - 0xbb, 0xeb, 0x3f, 0xde, 0x16, 0x00, 0x00, + // 1957 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xdd, 0x6e, 0xdb, 0xc8, + 0x15, 0x2e, 0x2d, 0x59, 0x3f, 0x47, 0x96, 0xd7, 0x99, 0x3a, 0xe9, 0x84, 0xc9, 0x6e, 0x1c, 0xe6, + 0xa7, 0x42, 0xb3, 0x90, 0x77, 0xbd, 0x4d, 0xbd, 0xd9, 0xec, 0x02, 0xb5, 0x25, 0x0b, 0xf6, 0x22, + 0xb1, 0x8d, 0x91, 0x93, 0x45, 0x5b, 0xa0, 0x0b, 0x4a, 0x1a, 0xcb, 0x84, 0x29, 0x0e, 0xcb, 0x19, + 0xc9, 0x76, 0xaf, 0x7a, 0xd3, 0xdb, 0xbe, 0x47, 0xd1, 0x47, 0xe8, 0x55, 0x5f, 0xa2, 0x97, 0x7d, + 0x84, 0xa2, 0x8f, 0x50, 0xcc, 0x0f, 0x29, 0xd2, 0x12, 0x65, 0xbb, 0xbd, 0xd2, 0x9c, 0xc3, 0xef, + 0x9c, 0x99, 0x73, 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x43, 0xbe, 0x98, 0x03, 0x2b, 0x1a, 0x60, + 0x3c, 0x83, 0xa0, 0x78, 0x4e, 0xaf, 0x74, 0x34, 0x54, 0x89, 0x5a, 0x3b, 0x7f, 0xb1, 0xe4, 0x0b, + 0x20, 0x1c, 0x8b, 0xf7, 0x94, 0x73, 0x77, 0x28, 0x03, 0xb0, 0x78, 0x10, 0x78, 0xc2, 0x44, 0xdf, + 0xcb, 0xbc, 0x97, 0x40, 0x38, 0x16, 0x12, 0x66, 0xa4, 0xf6, 0x7f, 0x42, 0x94, 0x14, 0xda, 0x86, + 0x62, 0xdb, 0x15, 0xae, 0x89, 0x85, 0x9c, 0xb9, 0x47, 0x22, 0x52, 0x82, 0x92, 0xdc, 0x2d, 0xcb, + 0xe7, 0x4e, 0x38, 0x16, 0xce, 0x73, 0x58, 0xbb, 0xae, 0x7d, 0x8e, 0x69, 0x5f, 0x41, 0x2d, 0xa5, + 0x45, 0xe5, 0xed, 0x51, 0x47, 0x01, 0x2a, 0x44, 0x2e, 0xa5, 0xad, 0xc9, 0x41, 0x56, 0xf4, 0x1e, + 0xce, 0x27, 0x50, 0x57, 0xaa, 0x13, 0x0f, 0xfe, 0x69, 0x09, 0xca, 0xb1, 0x8a, 0xed, 0x8c, 0xdd, + 0x4f, 0xf3, 0xec, 0x9e, 0x35, 0xf9, 0x35, 0x14, 0x65, 0xfd, 0x30, 0x26, 0xe7, 0x0c, 0x0d, 0x9d, + 0x41, 0x4a, 0x4c, 0xc2, 0xd1, 0x77, 0x50, 0x22, 0x94, 0xcb, 0x01, 0x47, 0x3f, 0x05, 0x9e, 0xcd, + 0x17, 0xd4, 0x98, 0xa9, 0xb0, 0x11, 0x92, 0xe2, 0x5d, 0x6f, 0x18, 0xb8, 0x3e, 0x2e, 0x2e, 0x12, + 0xd7, 0x98, 0x94, 0xb8, 0x66, 0x4c, 0xdd, 0xfd, 0x67, 0x0b, 0x6a, 0x0b, 0x5d, 0xbd, 0xf8, 0xb1, + 0x36, 0x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 0x35, 0xe6, 0x97, 0x50, 0x99, 0xd0, 0x48, 0xd0, + 0xcb, 0xa4, 0xeb, 0xe0, 0xd9, 0xf1, 0xf3, 0xa3, 0x42, 0x90, 0x04, 0x89, 0xbe, 0x81, 0x0a, 0x57, + 0x7a, 0x68, 0x3c, 0xb1, 0x7c, 0x96, 0x27, 0x65, 0xf6, 0x4b, 0xf0, 0x68, 0x13, 0x8a, 0x3e, 0x1b, + 0x72, 0x75, 0xef, 0xb5, 0xad, 0x47, 0x79, 0x72, 0xef, 0xd8, 0x90, 0x28, 0x20, 0x7a, 0x0b, 0x95, + 0x0b, 0x37, 0x0a, 0xbc, 0x60, 0x18, 0xbf, 0xa1, 0x9f, 0xe4, 0x09, 0xfd, 0xa0, 0x71, 0x24, 0x11, + 0x70, 0xea, 0x32, 0x5d, 0x4e, 0x99, 0xf1, 0x89, 0xf3, 0x1b, 0x19, 0xb5, 0x92, 0x34, 0xe6, 0x1f, + 0x40, 0x5d, 0x47, 0xfe, 0x47, 0x1a, 0x71, 0x39, 0xff, 0x59, 0x8b, 0xb2, 0x73, 0x37, 0x0d, 0x25, + 0x59, 0x49, 0xe7, 0x47, 0xd3, 0xd8, 0x62, 0x86, 0x8c, 0xa5, 0xd0, 0xed, 0x9f, 0xbb, 0xc3, 0xf8, + 0x9e, 0x62, 0x52, 0x7e, 0x99, 0x98, 0xfd, 0x74, 0x82, 0xc6, 0xa4, 0x8c, 0xcd, 0x88, 0x4e, 0x3c, + 0x3e, 0x1d, 0x45, 0x13, 0xda, 0xd9, 0x97, 0xaf, 0x05, 0x7f, 0x42, 0xf3, 0xff, 0x4a, 0x79, 0x99, + 0x3c, 0x95, 0x74, 0x71, 0x5b, 0x6d, 0x86, 0xbd, 0x66, 0x9b, 0x9e, 0x7a, 0x32, 0x86, 0x59, 0x10, + 0x3f, 0x9d, 0x64, 0x61, 0x35, 0x9a, 0xb4, 0x1b, 0xb6, 0xfe, 0x55, 0x06, 0x68, 0x25, 0xa6, 0xa2, +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, 0x5d, 0x06, 0xf2, 0xc2, 0x2f, 0x93, 0xe0, 0xbb, 0xc5, 0xdf, 0x2e, 0x85, + 0xbd, 0x5e, 0x49, 0xfd, 0xdb, 0xfd, 0xd5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x67, 0x70, + 0x17, 0xb9, 0x17, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2198,6 +2281,7 @@ type ControllerClient interface { Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error) DisconnectProcess(ctx context.Context, in *DisconnectProcessRequest, opts ...grpc.CallOption) (*DisconnectProcessResponse, error) + Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) } type controllerClient struct { @@ -2368,6 +2452,15 @@ func (c *controllerClient) DisconnectProcess(ctx context.Context, in *Disconnect return out, nil } +func (c *controllerClient) Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) { + out := new(SolveResponse) + err := c.cc.Invoke(ctx, "/buildx.controller.v1.Controller/Solve", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ControllerServer is the server API for Controller service. type ControllerServer interface { Build(context.Context, *BuildRequest) (*BuildResponse, error) @@ -2380,6 +2473,7 @@ type ControllerServer interface { Info(context.Context, *InfoRequest) (*InfoResponse, error) ListProcesses(context.Context, *ListProcessesRequest) (*ListProcessesResponse, error) DisconnectProcess(context.Context, *DisconnectProcessRequest) (*DisconnectProcessResponse, error) + Solve(context.Context, *SolveRequest) (*SolveResponse, error) } // UnimplementedControllerServer can be embedded to have forward compatible implementations. @@ -2416,6 +2510,9 @@ func (*UnimplementedControllerServer) ListProcesses(ctx context.Context, req *Li func (*UnimplementedControllerServer) DisconnectProcess(ctx context.Context, req *DisconnectProcessRequest) (*DisconnectProcessResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DisconnectProcess not implemented") } +func (*UnimplementedControllerServer) Solve(ctx context.Context, req *SolveRequest) (*SolveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Solve not implemented") +} func RegisterControllerServer(s *grpc.Server, srv ControllerServer) { s.RegisterService(&_Controller_serviceDesc, srv) @@ -2620,6 +2717,24 @@ func _Controller_DisconnectProcess_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Controller_Solve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SolveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Solve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/buildx.controller.v1.Controller/Solve", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Solve(ctx, req.(*SolveRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Controller_serviceDesc = grpc.ServiceDesc{ ServiceName: "buildx.controller.v1.Controller", HandlerType: (*ControllerServer)(nil), @@ -2652,6 +2767,10 @@ var _Controller_serviceDesc = grpc.ServiceDesc{ MethodName: "DisconnectProcess", Handler: _Controller_DisconnectProcess_Handler, }, + { + MethodName: "Solve", + Handler: _Controller_Solve_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/controller/pb/controller.proto b/controller/pb/controller.proto index 054d2b53..6ba91a77 100644 --- a/controller/pb/controller.proto +++ b/controller/pb/controller.proto @@ -4,6 +4,7 @@ package buildx.controller.v1; import "github.com/moby/buildkit/api/services/control/control.proto"; import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto"; +import "github.com/moby/buildkit/solver/pb/ops.proto"; option go_package = "pb"; @@ -18,6 +19,7 @@ service Controller { rpc Info(InfoRequest) returns (InfoResponse); rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse); rpc DisconnectProcess(DisconnectProcessRequest) returns (DisconnectProcessResponse); + rpc Solve(SolveRequest) returns (SolveResponse); } message ListProcessesRequest { @@ -244,3 +246,10 @@ message BuildxVersion { string version = 2; string revision = 3; } + +message SolveRequest { + string Ref = 1; + pb.Definition Target = 2; +} + +message SolveResponse {} diff --git a/controller/remote/client.go b/controller/remote/client.go index b3b6c12b..2a37d5a1 100644 --- a/controller/remote/client.go +++ b/controller/remote/client.go @@ -12,6 +12,7 @@ import ( "github.com/docker/buildx/util/progress" "github.com/moby/buildkit/client" "github.com/moby/buildkit/identity" + solverpb "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/grpcerrors" "github.com/pkg/errors" "golang.org/x/sync/errgroup" @@ -238,3 +239,52 @@ func (c *Client) build(ctx context.Context, ref string, options pb.BuildOptions, func (c *Client) client() pb.ControllerClient { return pb.NewControllerClient(c.conn) } + +func (c *Client) Solve(ctx context.Context, ref string, def *solverpb.Definition, progress progress.Writer) error { + statusChan := make(chan *client.SolveStatus) + eg, egCtx := errgroup.WithContext(ctx) + eg.Go(func() error { + defer close(statusChan) + return c.doSolve(egCtx, ref, def, statusChan) + }) + eg.Go(func() error { + for s := range statusChan { + st := s + progress.Write(st) + } + return nil + }) + return eg.Wait() +} + +func (c *Client) doSolve(ctx context.Context, ref string, def *solverpb.Definition, statusChan chan *client.SolveStatus) error { + eg, egCtx := errgroup.WithContext(ctx) + eg.Go(func() error { + if _, err := c.client().Solve(egCtx, &pb.SolveRequest{ + Ref: ref, + Target: def, + }); err != nil { + return err + } + return nil + }) + eg.Go(func() error { + stream, err := c.client().Status(egCtx, &pb.StatusRequest{ + Ref: ref, + }) + if err != nil { + return err + } + for { + resp, err := stream.Recv() + if err != nil { + if err == io.EOF { + return nil + } + return errors.Wrap(err, "failed to receive status") + } + statusChan <- pb.FromControlStatus(resp) + } + }) + return eg.Wait() +} diff --git a/controller/remote/server.go b/controller/remote/server.go index a39fea51..d6bb3ba6 100644 --- a/controller/remote/server.go +++ b/controller/remote/server.go @@ -43,6 +43,8 @@ type session struct { result *build.ResultHandle processes *processes.Manager + + originalResult *build.ResultHandle } func (s *session) cancelRunningProcesses() { @@ -208,6 +210,7 @@ func (m *Server) Build(ctx context.Context, req *pb.BuildRequest) (*pb.BuildResp // NOTE: buildFunc can return *build.ResultHandle even on error (e.g. when it's implemented using (github.com/docker/buildx/controller/build).RunBuild). if res != nil { s.result = res + s.originalResult = res s.cancelBuild = cancel s.buildOptions = req.Options m.session[ref] = s @@ -439,3 +442,64 @@ func (m *Server) Invoke(srv pb.Controller_InvokeServer) error { return eg.Wait() } + +func (m *Server) Solve(ctx context.Context, req *pb.SolveRequest) (*pb.SolveResponse, error) { + ref := req.Ref + if ref == "" { + return nil, errors.New("solve: empty key") + } + + m.sessionMu.Lock() + if _, ok := m.session[ref]; !ok || m.session[ref].result == nil { + m.sessionMu.Unlock() + return &pb.SolveResponse{}, errors.Errorf("solve: unknown reference: %q", ref) + } + s := m.session[ref] + s.cancelRunningProcesses() + if s.originalResult == nil { + return &pb.SolveResponse{}, errors.Errorf("no build has been called") + } + resultCtx := s.originalResult + if s.statusChan != nil { + m.sessionMu.Unlock() + return &pb.SolveResponse{}, errors.New("solve: build or status ongoing or status didn't call") + } + statusChan := make(chan *pb.StatusResponse) + s.statusChan = statusChan + m.session[ref] = s + m.sessionMu.Unlock() + + defer func() { + close(statusChan) + m.sessionMu.Lock() + s, ok := m.session[ref] + if ok { + s.statusChan = nil + m.session[ref] = s + } + m.sessionMu.Unlock() + }() + + // Get the target result context + ctx, cancel := context.WithCancel(ctx) + defer cancel() + pw := pb.NewProgressWriter(statusChan) + res, err := build.SolveWithResultHandler(ctx, "buildx", resultCtx, req.Target, pw) + if err == nil { + m.sessionMu.Lock() + if s, ok := m.session[ref]; ok { + s.result = res + s.cancelBuild = cancel + m.session[ref] = s + if se := res.SolveError(); se != nil { + err = errors.Errorf("failed solve: %v", se) + } + } else { + m.sessionMu.Unlock() + return nil, errors.Errorf("build: unknown key %v", ref) + } + m.sessionMu.Unlock() + } + + return &pb.SolveResponse{}, err +}