Add Solve API for performing a build on a build definition

This commit adds Solve API to the controller. This receives a build definition,
performs that build using ResultHandler held by that session. After Solve
completes, the client can debug the result using other APIs including Invoke.
Note that the ResultHandle provided by Solve overwrites the ResultHandle
previously stored in that session (possibly generated by the past Build or Solve
API call).

Using this API, user can perform build-and-debugging loop on the same session.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
Kohei Tokunaga
2023-06-30 20:13:10 +09:00
parent de693264a8
commit f72ea677f1
7 changed files with 415 additions and 120 deletions

View File

@@ -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 {