Skip to content

Commit aadbe78

Browse files
committed
vendor: moby/api v1.52.0-beta.4, moby/client v0.1.0-beta.3
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 65ce41f commit aadbe78

File tree

438 files changed

+9018
-24268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

438 files changed

+9018
-24268
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ linters:
6464
alias:
6565
- pkg: "github.com/containerd/errdefs"
6666
alias: "cerrdefs"
67-
- pkg: "github.com/docker/docker/client"
67+
- pkg: "github.com/moby/moby/client"
6868
alias: "dockerclient"
6969
- pkg: "github.com/opencontainers/image-spec/specs-go/v1"
7070
alias: "ocispecs"

build/build.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import (
2929
"github.com/docker/buildx/util/resolver"
3030
"github.com/docker/buildx/util/waitmap"
3131
"github.com/docker/cli/opts"
32-
"github.com/docker/docker/api/types/image"
33-
"github.com/docker/docker/pkg/jsonmessage"
3432
"github.com/moby/buildkit/client"
3533
"github.com/moby/buildkit/client/llb"
3634
"github.com/moby/buildkit/exporter/containerimage/exptypes"
@@ -43,6 +41,8 @@ import (
4341
spb "github.com/moby/buildkit/sourcepolicy/pb"
4442
"github.com/moby/buildkit/util/progress/progresswriter"
4543
"github.com/moby/buildkit/util/tracing"
44+
"github.com/moby/moby/api/types/jsonstream"
45+
dockerclient "github.com/moby/moby/client"
4646
"github.com/opencontainers/go-digest"
4747
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
4848
"github.com/pkg/errors"
@@ -802,7 +802,7 @@ func pushWithMoby(ctx context.Context, d *driver.DriverHandle, name string, l pr
802802
return err
803803
}
804804

805-
rc, err := api.ImagePush(ctx, name, image.PushOptions{
805+
rc, err := api.ImagePush(ctx, name, dockerclient.ImagePushOptions{
806806
RegistryAuth: creds,
807807
})
808808
if err != nil {
@@ -824,7 +824,7 @@ func pushWithMoby(ctx context.Context, d *driver.DriverHandle, name string, l pr
824824
dec := json.NewDecoder(rc)
825825
var parsedError error
826826
for {
827-
var jm jsonmessage.JSONMessage
827+
var jm jsonstream.Message
828828
if err := dec.Decode(&jm); err != nil {
829829
if parsedError != nil {
830830
return parsedError
@@ -888,7 +888,9 @@ func remoteDigestWithMoby(ctx context.Context, d *driver.DriverHandle, name stri
888888
if len(img.RepoDigests) == 0 {
889889
return "", nil
890890
}
891-
remoteImage, err := api.DistributionInspect(ctx, name, creds)
891+
remoteImage, err := api.DistributionInspect(ctx, name, dockerclient.DistributionInspectOptions{
892+
EncodedRegistryAuth: creds,
893+
})
892894
if err != nil {
893895
return "", err
894896
}

builder/builder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
dopts "github.com/docker/cli/opts"
2626
"github.com/google/shlex"
2727
"github.com/moby/buildkit/util/progress/progressui"
28+
dockerclient "github.com/moby/moby/client"
2829
"github.com/pkg/errors"
2930
"github.com/spf13/pflag"
3031
"github.com/tonistiigi/go-csvvalue"
@@ -247,7 +248,7 @@ func (b *Builder) Factory(ctx context.Context, dialMeta map[string][]string) (_
247248
}
248249
// check if endpoint is healthy is needed to determine the driver type.
249250
// if this fails then can't continue with driver selection.
250-
if _, err = dockerapi.Ping(ctx); err != nil {
251+
if _, err = dockerapi.Ping(ctx, dockerclient.PingOptions{}); err != nil {
251252
return
252253
}
253254
b.driverFactory.Factory, err = driver.GetDefaultFactory(ctx, ep, dockerapi, false, dialMeta)

commands/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"github.com/docker/cli/cli"
3737
"github.com/docker/cli/cli/command"
3838
dockeropts "github.com/docker/cli/opts"
39-
"github.com/docker/docker/api/types/versions"
4039
"github.com/moby/buildkit/client"
4140
"github.com/moby/buildkit/exporter/containerimage/exptypes"
4241
"github.com/moby/buildkit/frontend/subrequests"
@@ -49,6 +48,7 @@ import (
4948
sourcepolicy "github.com/moby/buildkit/sourcepolicy/pb"
5049
"github.com/moby/buildkit/util/grpcerrors"
5150
"github.com/moby/buildkit/util/progress/progressui"
51+
"github.com/moby/moby/client/pkg/versions"
5252
"github.com/moby/sys/atomicwriter"
5353
"github.com/morikuni/aec"
5454
"github.com/pkg/errors"

commands/diskusage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts duOptions) er
169169
}
170170

171171
defer func() {
172-
if (fctx.Format != duDefaultTableFormat && fctx.Format != duDefaultPrettyTemplate) || fctx.Format.IsJSON() || opts.filter.Value().Len() > 0 {
172+
if (fctx.Format != duDefaultTableFormat && fctx.Format != duDefaultPrettyTemplate) || fctx.Format.IsJSON() || len(opts.filter.Value()) > 0 {
173173
return
174174
}
175175
printSummary(dockerCli.Out(), out)

commands/prune.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"maps"
78
"os"
9+
"slices"
810
"strings"
911
"text/tabwriter"
1012
"time"
@@ -14,12 +16,12 @@ import (
1416
"github.com/docker/cli/cli"
1517
"github.com/docker/cli/cli/command"
1618
"github.com/docker/cli/opts"
17-
"github.com/docker/docker/api/types/filters"
1819
"github.com/docker/go-units"
1920
"github.com/moby/buildkit/client"
2021
gateway "github.com/moby/buildkit/frontend/gateway/client"
2122
pb "github.com/moby/buildkit/solver/pb"
2223
"github.com/moby/buildkit/util/apicaps"
24+
dclient "github.com/moby/moby/client"
2325
"github.com/pkg/errors"
2426
"github.com/spf13/cobra"
2527
"golang.org/x/sync/errgroup"
@@ -42,9 +44,7 @@ const (
4244
)
4345

4446
func runPrune(ctx context.Context, dockerCli command.Cli, opts pruneOptions) error {
45-
pruneFilters := opts.filter.Value()
46-
pruneFilters = command.PruneFilters(dockerCli, pruneFilters)
47-
47+
pruneFilters := command.PruneFilters(dockerCli, opts.filter.Value())
4848
pi, err := toBuildkitPruneInfo(pruneFilters)
4949
if err != nil {
5050
return err
@@ -189,20 +189,22 @@ func pruneCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
189189
return cmd
190190
}
191191

192-
func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) {
193-
var until time.Duration
194-
untilValues := f.Get("until") // canonical
195-
unusedForValues := f.Get("unused-for") // deprecated synonym for "until" filter
192+
// getFilter returns the list of values associated with the key
193+
func getFilter(f dclient.Filters, key string) []string {
194+
return slices.Collect(maps.Keys(f[key]))
195+
}
196196

197-
if len(untilValues) > 0 && len(unusedForValues) > 0 {
198-
return nil, errors.Errorf("conflicting filters %q and %q", "until", "unused-for")
197+
func toBuildkitPruneInfo(pruneFilters dclient.Filters) (*client.PruneInfo, error) {
198+
var until time.Duration
199+
if len(pruneFilters["until"]) > 0 && len(pruneFilters["unused-for"]) > 0 {
200+
return nil, errors.New(`conflicting filters "until" and "unused-for"`)
199201
}
200202
untilKey := "until"
201-
if len(unusedForValues) > 0 {
202-
untilKey = "unused-for"
203+
if len(pruneFilters["unused-for"]) > 0 {
204+
untilKey = "unused-for" // deprecated synonym for "until" filter
203205
}
204-
untilValues = append(untilValues, unusedForValues...)
205206

207+
untilValues := getFilter(pruneFilters, untilKey)
206208
switch len(untilValues) {
207209
case 0:
208210
// nothing to do
@@ -213,16 +215,16 @@ func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) {
213215
return nil, errors.Wrapf(err, "%q filter expects a duration (e.g., '24h')", untilKey)
214216
}
215217
default:
216-
return nil, errors.Errorf("filters expect only one value")
218+
return nil, errors.Errorf("%q filter expects only one value", untilKey)
217219
}
218220

219-
filters := make([]string, 0, f.Len())
220-
for _, filterKey := range f.Keys() {
221+
filters := make([]string, 0, len(pruneFilters))
222+
for filterKey := range pruneFilters {
221223
if filterKey == untilKey {
222224
continue
223225
}
224226

225-
values := f.Get(filterKey)
227+
values := getFilter(pruneFilters, filterKey)
226228
switch len(values) {
227229
case 0:
228230
filters = append(filters, filterKey)
@@ -235,7 +237,7 @@ func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) {
235237
filters = append(filters, filterKey+"=="+values[0])
236238
}
237239
default:
238-
return nil, errors.Errorf("filters expect only one value")
240+
return nil, errors.Errorf("%q filter expects only one value", filterKey)
239241
}
240242
}
241243
return &client.PruneInfo{

0 commit comments

Comments
 (0)