mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
Introduce a client interface, to abstract from buildkit client.
This will allow further enhancement like caching remote driver responses. Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
@ -8,7 +8,6 @@ import (
|
||||
"github.com/docker/buildx/util/progress"
|
||||
clitypes "github.com/docker/cli/cli/config/types"
|
||||
controlapi "github.com/moby/buildkit/api/services/control"
|
||||
"github.com/moby/buildkit/client"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -58,13 +57,13 @@ type Driver interface {
|
||||
Version(context.Context) (string, error)
|
||||
Stop(ctx context.Context, force bool) error
|
||||
Rm(ctx context.Context, force, rmVolume, rmDaemon bool) error
|
||||
Client(ctx context.Context) (*client.Client, error)
|
||||
Client(ctx context.Context) (Client, error)
|
||||
Features(ctx context.Context) map[Feature]bool
|
||||
IsMobyDriver() bool
|
||||
Config() InitConfig
|
||||
}
|
||||
|
||||
func Boot(ctx, clientContext context.Context, d *DriverHandle, pw progress.Writer) (*client.Client, error) {
|
||||
func Boot(ctx, clientContext context.Context, d *DriverHandle, pw progress.Writer) (Client, error) {
|
||||
try := 0
|
||||
for {
|
||||
info, err := d.Info(ctx)
|
||||
@ -92,7 +91,7 @@ func Boot(ctx, clientContext context.Context, d *DriverHandle, pw progress.Write
|
||||
}
|
||||
}
|
||||
|
||||
func historyAPISupported(ctx context.Context, c *client.Client) bool {
|
||||
func historyAPISupported(ctx context.Context, c Client) bool {
|
||||
cl, err := c.ControlClient().ListenBuildHistory(ctx, &controlapi.BuildHistoryRequest{
|
||||
ActiveOnly: true,
|
||||
Ref: "buildx-test-history-api-feature", // dummy ref to check if the server supports the API
|
||||
|
Reference in New Issue
Block a user