Skip to content

Commit 9604e55

Browse files
committed
update to latest
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent a0a9813 commit 9604e55

Some content is hidden

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

46 files changed

+496
-500
lines changed

go.mod

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/containerd/platforms v1.0.0-rc.1
2121
github.com/distribution/reference v0.6.0
2222
github.com/docker/buildx v0.29.1
23-
github.com/docker/cli v29.0.0-rc.2+incompatible // master (v29.0.0-dev)
23+
github.com/docker/cli v29.0.0-rc.2.0.20251104132644-7414d73fc119+incompatible // master (v29.0.0-dev)
2424
github.com/docker/cli-docs-tool v0.10.0
2525
github.com/docker/docker v28.5.1+incompatible
2626
github.com/docker/go-connections v0.6.0
@@ -70,9 +70,7 @@ require (
7070

7171
require (
7272
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
73-
github.com/beorn7/perks v1.0.1 // indirect
7473
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
75-
github.com/cespare/xxhash/v2 v2.3.0 // indirect
7674
github.com/containerd/containerd/api v1.9.0 // indirect
7775
github.com/containerd/continuity v0.4.5 // indirect
7876
github.com/containerd/errdefs/pkg v0.3.0 // indirect
@@ -81,10 +79,8 @@ require (
8179
github.com/containerd/typeurl/v2 v2.2.3 // indirect
8280
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
8381
github.com/davecgh/go-spew v1.1.1 // indirect
84-
github.com/docker/distribution v2.8.3+incompatible // indirect
8582
github.com/docker/docker-credential-helpers v0.9.3 // indirect
8683
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
87-
github.com/docker/go-metrics v0.0.1 // indirect
8884
github.com/felixge/httpsnoop v1.0.4 // indirect
8985
github.com/fvbommel/sortorder v1.1.0 // indirect
9086
github.com/go-logr/logr v1.4.3 // indirect
@@ -103,14 +99,11 @@ require (
10399
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf // indirect
104100
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
105101
github.com/klauspost/compress v1.18.0 // indirect
106-
github.com/magiconair/properties v1.8.9 // indirect
107102
github.com/mattn/go-colorable v0.1.13 // indirect
108103
github.com/mattn/go-isatty v0.0.20 // indirect
109104
github.com/mattn/go-runewidth v0.0.16 // indirect
110105
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
111-
github.com/miekg/pkcs11 v1.1.1 // indirect
112106
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
113-
github.com/mitchellh/mapstructure v1.5.0 // indirect
114107
github.com/moby/docker-image-spec v1.3.1 // indirect
115108
github.com/moby/locker v1.0.1 // indirect
116109
github.com/moby/sys/capability v0.4.0 // indirect
@@ -119,22 +112,16 @@ require (
119112
github.com/moby/sys/symlink v0.3.0 // indirect
120113
github.com/moby/sys/user v0.4.0 // indirect
121114
github.com/moby/sys/userns v0.1.0 // indirect
122-
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
123115
github.com/otiai10/mint v1.6.3 // indirect
124116
github.com/pelletier/go-toml v1.9.5 // indirect
125117
github.com/pkg/errors v0.9.1 // indirect
126118
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
127119
github.com/pmezard/go-difflib v1.0.0 // indirect
128-
github.com/prometheus/client_golang v1.22.0 // indirect
129-
github.com/prometheus/client_model v0.6.1 // indirect
130-
github.com/prometheus/common v0.62.0 // indirect
131-
github.com/prometheus/procfs v0.15.1 // indirect
132120
github.com/rivo/uniseg v0.2.0 // indirect
133121
github.com/russross/blackfriday/v2 v2.1.0 // indirect
134122
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
135123
github.com/secure-systems-lab/go-securesystemslib v0.6.0 // indirect
136124
github.com/shibumi/go-pathspec v1.3.0 // indirect
137-
github.com/theupdateframework/notary v0.7.0 // indirect
138125
github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect
139126
github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect
140127
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect

go.sum

Lines changed: 2 additions & 161 deletions
Large diffs are not rendered by default.

pkg/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ type VolumesOptions struct {
148148
Services []string
149149
}
150150

151-
type VolumesSummary = *volume.Volume
151+
type VolumesSummary = volume.Volume
152152

153153
type ScaleOptions struct {
154154
Services []string

pkg/api/dryrunclient.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"fmt"
2626
"io"
2727
"net"
28+
"net/http"
2829
"runtime"
2930
"strings"
3031
"sync"
@@ -59,6 +60,14 @@ type execDetails struct {
5960
command []string
6061
}
6162

63+
type fakeStreamResult struct {
64+
io.ReadCloser
65+
client.ImagePushResponse // same interface as [client.ImagePullResponse]
66+
}
67+
68+
func (e fakeStreamResult) Read(p []byte) (int, error) { return e.ReadCloser.Read(p) }
69+
func (e fakeStreamResult) Close() error { return e.ReadCloser.Close() }
70+
6271
// NewDryRunClient produces a DryRunClient
6372
func NewDryRunClient(apiClient client.APIClient, cli command.Cli) (*DryRunClient, error) {
6473
b, err := builder.New(cli, builder.WithSkippedValidation())
@@ -232,8 +241,7 @@ func (d *DryRunClient) ImagePull(ctx context.Context, ref string, options client
232241
if _, _, err := d.resolver.Resolve(ctx, ref); err != nil {
233242
return nil, err
234243
}
235-
// FIXME(thaJeztah): mock this
236-
return nil, nil
244+
return fakeStreamResult{ReadCloser: http.NoBody}, nil
237245
}
238246

239247
func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options client.ImagePushOptions) (client.ImagePushResponse, error) {
@@ -256,11 +264,7 @@ func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options client
256264
if err != nil {
257265
return nil, err
258266
}
259-
// FIXME(thaJeztah): mock this
260-
rc := io.NopCloser(bytes.NewReader(jsonMessage))
261-
_ = rc
262-
// return rc, nil
263-
return nil, nil
267+
return fakeStreamResult{ReadCloser: io.NopCloser(bytes.NewReader(jsonMessage))}, nil
264268
}
265269

266270
func (d *DryRunClient) ImageRemove(ctx context.Context, imageName string, options client.ImageRemoveOptions) (client.ImageRemoveResult, error) {

pkg/bridge/convert.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,14 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
127127
}
128128
containerConfig.User = usr.Uid
129129
}
130-
created, err := dockerCli.Client().ContainerCreate(ctx, containerConfig, &container.HostConfig{
131-
AutoRemove: true,
132-
Binds: binds,
133-
}, &network.NetworkingConfig{}, nil, "")
130+
created, err := dockerCli.Client().ContainerCreate(ctx, client.ContainerCreateOptions{
131+
Config: containerConfig,
132+
HostConfig: &container.HostConfig{
133+
Binds: binds,
134+
AutoRemove: true,
135+
},
136+
NetworkingConfig: &network.NetworkingConfig{},
137+
})
134138
if err != nil {
135139
return err
136140
}
@@ -222,5 +226,5 @@ func inspectWithPull(ctx context.Context, dockerCli command.Cli, imageName strin
222226
return image.InspectResponse{}, err
223227
}
224228
}
225-
return inspect, err
229+
return inspect.InspectResponse, err
226230
}

pkg/bridge/transformers.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import (
2424

2525
"github.com/docker/cli/cli/command"
2626
"github.com/moby/go-archive"
27-
"github.com/moby/moby/api/types/container"
2827
"github.com/moby/moby/api/types/image"
29-
"github.com/moby/moby/api/types/network"
3028
"github.com/moby/moby/client"
3129
)
3230

@@ -65,34 +63,39 @@ func CreateTransformer(ctx context.Context, dockerCli command.Cli, options Creat
6563
return err
6664
}
6765

68-
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
66+
created, err := dockerCli.Client().ContainerCreate(ctx, client.ContainerCreateOptions{
6967
Image: options.From,
70-
}, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
68+
})
69+
7170
defer func() {
72-
_ = dockerCli.Client().ContainerRemove(context.Background(), created.ID, client.ContainerRemoveOptions{Force: true})
71+
_, _ = dockerCli.Client().ContainerRemove(context.Background(), created.ID, client.ContainerRemoveOptions{
72+
Force: true,
73+
})
7374
}()
7475

7576
if err != nil {
7677
return err
7778
}
78-
content, stat, err := dockerCli.Client().CopyFromContainer(ctx, created.ID, templatesPath)
79+
resp, err := dockerCli.Client().CopyFromContainer(ctx, created.ID, client.CopyFromContainerOptions{
80+
SourcePath: templatesPath,
81+
})
7982
if err != nil {
8083
return err
8184
}
8285
defer func() {
83-
_ = content.Close()
86+
_ = resp.Content.Close()
8487
}()
8588

8689
srcInfo := archive.CopyInfo{
8790
Path: templatesPath,
8891
Exists: true,
89-
IsDir: stat.Mode.IsDir(),
92+
IsDir: resp.Stat.Mode.IsDir(),
9093
}
9194

92-
preArchive := content
95+
preArchive := resp.Content
9396
if srcInfo.RebaseName != "" {
9497
_, srcBase := archive.SplitPathDirEntry(srcInfo.Path)
95-
preArchive = archive.RebaseArchiveEntries(content, srcBase, srcInfo.RebaseName)
98+
preArchive = archive.RebaseArchiveEntries(resp.Content, srcBase, srcInfo.RebaseName)
9699
}
97100

98101
if err := archive.CopyTo(preArchive, srcInfo, out); err != nil {
@@ -111,8 +114,11 @@ COPY templates /templates
111114
}
112115

113116
func ListTransformers(ctx context.Context, dockerCli command.Cli) ([]image.Summary, error) {
114-
api := dockerCli.Client()
115-
return api.ImageList(ctx, client.ImageListOptions{
117+
res, err := dockerCli.Client().ImageList(ctx, client.ImageListOptions{
116118
Filters: make(client.Filters).Add("label", fmt.Sprintf("%s=%s", TransformerLabel, "transformation")),
117119
})
120+
if err != nil {
121+
return nil, err
122+
}
123+
return res.Items, nil
118124
}

pkg/compose/attach.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (s *composeService) attachContainer(ctx context.Context, container containe
6868
}
6969

7070
func (s *composeService) doAttachContainer(ctx context.Context, service, id, name string, listener api.ContainerEventListener) error {
71-
inspect, err := s.apiClient().ContainerInspect(ctx, id)
71+
inspect, err := s.apiClient().ContainerInspect(ctx, id, client.ContainerInspectOptions{})
7272
if err != nil {
7373
return err
7474
}
@@ -92,7 +92,7 @@ func (s *composeService) doAttachContainer(ctx context.Context, service, id, nam
9292
})
9393
})
9494

95-
_, _, err = s.attachContainerStreams(ctx, id, inspect.Config.Tty, nil, wOut, wErr)
95+
_, _, err = s.attachContainerStreams(ctx, id, inspect.Container.Config.Tty, nil, wOut, wErr)
9696
return err
9797
}
9898

@@ -160,8 +160,8 @@ func (s *composeService) getContainerStreams(ctx context.Context, container stri
160160
Logs: false,
161161
})
162162
if err == nil {
163-
stdout = ContainerStdout{HijackedResponse: cnx}
164-
stdin = ContainerStdin{HijackedResponse: cnx}
163+
stdout = ContainerStdout{HijackedResponse: cnx.HijackedResponse}
164+
stdin = ContainerStdin{HijackedResponse: cnx.HijackedResponse}
165165
return stdin, stdout, nil
166166
}
167167

pkg/compose/compose.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ func (s *composeService) actualVolumes(ctx context.Context, projectName string)
457457
}
458458

459459
actual := types.Volumes{}
460-
for _, vol := range volumes.Volumes {
460+
for _, vol := range volumes.Items {
461461
actual[vol.Labels[api.VolumeLabel]] = types.VolumeConfig{
462462
Name: vol.Name,
463463
Driver: vol.Driver,
@@ -476,7 +476,7 @@ func (s *composeService) actualNetworks(ctx context.Context, projectName string)
476476
}
477477

478478
actual := types.Networks{}
479-
for _, net := range networks {
479+
for _, net := range networks.Items {
480480
actual[net.Labels[api.NetworkLabel]] = types.NetworkConfig{
481481
Name: net.Name,
482482
Driver: net.Driver,
@@ -494,11 +494,11 @@ var swarmEnabled = struct {
494494

495495
func (s *composeService) isSWarmEnabled(ctx context.Context) (bool, error) {
496496
swarmEnabled.once.Do(func() {
497-
info, err := s.apiClient().Info(ctx)
497+
res, err := s.apiClient().Info(ctx, client.InfoOptions{})
498498
if err != nil {
499499
swarmEnabled.err = err
500500
}
501-
switch info.Swarm.LocalNodeState {
501+
switch res.Info.Swarm.LocalNodeState {
502502
case swarm.LocalNodeStateInactive, swarm.LocalNodeStateLocked:
503503
swarmEnabled.val = false
504504
default:
@@ -519,7 +519,7 @@ var runtimeVersion runtimeVersionCache
519519
func (s *composeService) RuntimeVersion(ctx context.Context) (string, error) {
520520
// TODO(thaJeztah): this should use Client.ClientVersion), which has the negotiated version.
521521
runtimeVersion.once.Do(func() {
522-
version, err := s.apiClient().ServerVersion(ctx)
522+
version, err := s.apiClient().ServerVersion(ctx, client.ServerVersionOptions{})
523523
if err != nil {
524524
runtimeVersion.err = err
525525
}

pkg/compose/containers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ const (
4141
)
4242

4343
func (s *composeService) getContainers(ctx context.Context, project string, oneOff oneOff, all bool, selectedServices ...string) (Containers, error) {
44-
var containers Containers
45-
var err error
46-
containers, err = s.apiClient().ContainerList(ctx, client.ContainerListOptions{
44+
res, err := s.apiClient().ContainerList(ctx, client.ContainerListOptions{
4745
Filters: getDefaultFilters(project, oneOff, selectedServices...),
4846
All: all,
4947
})
5048
if err != nil {
5149
return nil, err
5250
}
51+
containers := Containers(res.Items)
5352
if len(selectedServices) > 1 {
5453
containers = containers.filter(isService(selectedServices...))
5554
}
@@ -77,13 +76,14 @@ func (s *composeService) getSpecifiedContainer(ctx context.Context, projectName
7776
if containerIndex > 0 {
7877
defaultFilters.Add("label", containerNumberFilter(containerIndex))
7978
}
80-
containers, err := s.apiClient().ContainerList(ctx, client.ContainerListOptions{
79+
res, err := s.apiClient().ContainerList(ctx, client.ContainerListOptions{
8180
Filters: defaultFilters,
8281
All: all,
8382
})
8483
if err != nil {
8584
return container.Summary{}, err
8685
}
86+
containers := res.Items
8787
if len(containers) < 1 {
8888
if containerIndex > 0 {
8989
return container.Summary{}, fmt.Errorf("service %q is not running container #%d", serviceName, containerIndex)

0 commit comments

Comments
 (0)