Skip to content

Commit

Permalink
use v25 types
Browse files Browse the repository at this point in the history
  • Loading branch information
blampe committed Mar 5, 2024
1 parent 08c1260 commit 5290f81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions provider/internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/docker/cli/cli/flags"
manifesttypes "github.com/docker/cli/cli/manifest/types"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/moby/buildkit/client"
"github.com/moby/buildkit/util/progress/progressui"

Expand All @@ -32,7 +33,7 @@ type Client interface {
Build(ctx provider.Context, opts controllerapi.BuildOptions) (*client.SolveResponse, error)
BuildKitEnabled() (bool, error)
Inspect(ctx context.Context, id string) ([]manifesttypes.ImageManifest, error)
Delete(ctx context.Context, id string) ([]types.ImageDeleteResponseItem, error)
Delete(ctx context.Context, id string) ([]image.DeleteResponse, error)
}

type docker struct {
Expand Down Expand Up @@ -106,6 +107,9 @@ func (d *docker) Build(
res.Done()
}

if printErr := printer.Wait(); printErr != nil {
return solve, printErr
}
for _, w := range printer.Warnings() {
b := &bytes.Buffer{}
fmt.Fprintf(b, "%s", w.Short)
Expand Down Expand Up @@ -143,7 +147,7 @@ func (d *docker) Inspect(ctx context.Context, id string) ([]manifesttypes.ImageM
}

// Delete deletes an image with the given ID.
func (d *docker) Delete(ctx context.Context, id string) ([]types.ImageDeleteResponseItem, error) {
func (d *docker) Delete(ctx context.Context, id string) ([]image.DeleteResponse, error) {
return d.cli.Client().ImageRemove(ctx, id, types.ImageRemoveOptions{
Force: true, // Needed in case the image has multiple tags.
})
Expand Down
4 changes: 2 additions & 2 deletions provider/internal/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
controllerapi "github.com/docker/buildx/controller/pb"
manifesttypes "github.com/docker/cli/cli/manifest/types"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/moby/buildkit/client"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestLifecycle(t *testing.T) {
),
c.EXPECT().Inspect(gomock.Any(), "docker.io/blampe/buildkit-e2e:main"),
c.EXPECT().Delete(gomock.Any(), "test").Return(
[]types.ImageDeleteResponseItem{{Deleted: "deleted"}, {Untagged: "untagged"}}, nil),
[]image.DeleteResponse{{Deleted: "deleted"}, {Untagged: "untagged"}}, nil),
)
return c
},
Expand Down
12 changes: 6 additions & 6 deletions provider/internal/mock/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5290f81

Please sign in to comment.