Skip to content

refactor: use moby/moby/client#753

Merged
acouvreur merged 21 commits intomainfrom
use-moby-client
May 7, 2026
Merged

refactor: use moby/moby/client#753
acouvreur merged 21 commits intomainfrom
use-moby-client

Conversation

@acouvreur
Copy link
Copy Markdown
Member

This should reduce the size of the binary by using the new moby/moby/client and moby/moby/api modules.

testcontainers-go is still using the docker/docker module, waiting for: testcontainers/testcontainers-go#3496

Copilot AI review requested due to automatic review settings November 25, 2025 02:08
@github-actions github-actions Bot added the provider Issue related to a provider label Nov 25, 2025
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request successfully refactors the codebase to use the new moby/moby/client and moby/moby/api modules instead of the legacy docker/docker module. The goal is to reduce binary size by using the modularized Moby packages.

Key Changes

  • Client initialization: Updated from client.NewClientWithOpts() to client.New() across Docker and Docker Swarm providers
  • API method signatures: Adapted to new API patterns including return value changes (e.g., ContainerStop, ContainerStart now return results) and options structures (e.g., client.ServiceUpdateOptions now wraps Version and Spec)
  • Data structure access: Updated to use new collection wrappers (e.g., services.Items instead of direct slice access, spec.Container.State instead of spec.State)
  • Filters API: Migrated from filters.NewArgs() to client.Filters{} with the same Add() method pattern
  • Events API: Transitioned from dual-channel pattern to result object pattern (result.Messages and result.Err instead of separate channels)

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/testcontainers/pind/pind.go Removed Docker-specific imports; critical container configuration commented out
pkg/sabliercmd/provider.go Updated client initialization to use client.New() instead of client.NewClientWithOpts()
pkg/provider/dockerswarm/*.go Updated imports, filters API, service list/inspect methods to use new collection wrappers, ServiceUpdate options structure
pkg/provider/docker/*.go Updated imports, container methods to handle new return values, events pattern, inspect response structure
go.mod Added moby/moby/api and moby/moby/client dependencies; moved docker/docker to indirect dependency
go.sum Updated dependency checksums for new modules
Makefile Added .PHONY: build directive for make target

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread pkg/testcontainers/pind/pind.go Outdated
Comment thread pkg/testcontainers/pind/pind.go Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 25, 2025

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
194 3 191 0
View the top 3 failed tests by shortest run time
TestDockerClassicProvider_Start/container_start_as_expected
Stack Traces | 0.030s run time
Failed
TestPodmanProvider_InstanceList
Stack Traces | 8.680s run time
Failed
TestDockerClassicProvider_Start
Stack Traces | 10.880s run time
Failed

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 25, 2025

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
194 3 191 0
View the top 3 failed test(s) by shortest run time
github.com/sablierapp/sablier/pkg/provider/docker::TestDockerClassicProvider_Start/container_start_as_expected
Stack Traces | 0.03s run time
Failed
github.com/sablierapp/sablier/pkg/provider/podman::TestPodmanProvider_InstanceList
Stack Traces | 8.68s run time
Failed
github.com/sablierapp/sablier/pkg/provider/docker::TestDockerClassicProvider_Start
Stack Traces | 10.9s run time
Failed

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 25, 2025

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Diff between sablier and sablier                                                                         │
├──────────┬───────────────────────────────────────────────────────────────┬──────────┬──────────┬─────────┤
│ PERCENT  │ NAME                                                          │ OLD SIZE │ NEW SIZE │ DIFF    │
├──────────┼───────────────────────────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ +100%    │ go.mongodb.org/mongo-driver/v2                                │          │ 672 kB   │ +672 kB │
│ +100%    │ github.com/moby/moby/client                                   │          │ 434 kB   │ +434 kB │
│ +100%    │ github.com/moby/moby/api                                      │          │ 148 kB   │ +148 kB │
│ +1.53%   │ runtime                                                       │ 3.4 MB   │ 3.4 MB   │ +51 kB  │
│ +1.83%   │ github.com/quic-go/quic-go                                    │ 1.3 MB   │ 1.3 MB   │ +24 kB  │
│ +2.46%   │ <autogenerated>                                               │ 756 kB   │ 775 kB   │ +19 kB  │
│ +5.45%   │ github.com/gin-gonic/gin                                      │ 319 kB   │ 336 kB   │ +17 kB  │
│ +87.50%  │ unique                                                        │ 18 kB    │ 34 kB    │ +16 kB  │
│ +2.98%   │ github.com/go-playground/validator/v10                        │ 316 kB   │ 326 kB   │ +9.4 kB │
│ +3.50%   │ github.com/sablierapp/sablier                                 │ 237 kB   │ 245 kB   │ +8.3 kB │
│ +7.42%   │ sync                                                          │ 107 kB   │ 114 kB   │ +7.9 kB │
│ +1.22%   │ github.com/klauspost/compress                                 │ 529 kB   │ 535 kB   │ +6.5 kB │
│ +1.55%   │ go.opentelemetry.io/otel                                      │ 391 kB   │ 397 kB   │ +6.1 kB │
│ +160.69% │ golang.org/x/sync                                             │ 2.7 kB   │ 7.1 kB   │ +4.4 kB │
│ +0.37%   │ golang.org/x/net                                              │ 895 kB   │ 899 kB   │ +3.3 kB │
│ +0.18%   │ go.podman.io/image/v5                                         │ 1.4 MB   │ 1.4 MB   │ +2.6 kB │
│ +0.31%   │ github.com/goccy/go-yaml                                      │ 700 kB   │ 702 kB   │ +2.2 kB │
│ +23.38%  │ weak                                                          │ 8.2 kB   │ 10 kB    │ +1.9 kB │
│ +0.61%   │ go.yaml.in/yaml/v3                                            │ 312 kB   │ 314 kB   │ +1.9 kB │
│ +0.32%   │ k8s.io/kube-openapi                                           │ 466 kB   │ 467 kB   │ +1.5 kB │
│ +0.56%   │ encoding/json                                                 │ 171 kB   │ 172 kB   │ +951 B  │
│ +0.23%   │ slices                                                        │ 342 kB   │ 343 kB   │ +795 B  │
│ +0.06%   │ google.golang.org/grpc                                        │ 1.2 MB   │ 1.2 MB   │ +738 B  │
│ +1.83%   │ github.com/tchap/go-patricia/v2                               │ 30 kB    │ 30 kB    │ +541 B  │
│ +0.23%   │ github.com/pelletier/go-toml/v2                               │ 217 kB   │ 217 kB   │ +505 B  │
│ +0.26%   │ sigs.k8s.io/json                                              │ 173 kB   │ 173 kB   │ +452 B  │
│ +14.12%  │ iter                                                          │ 2.0 kB   │ 2.3 kB   │ +285 B  │
│ +0.00%   │ k8s.io/api                                                    │ 16 MB    │ 16 MB    │ +258 B  │
│ +0.27%   │ archive/tar                                                   │ 86 kB    │ 86 kB    │ +234 B  │
│ +0.01%   │ k8s.io/apimachinery                                           │ 1.7 MB   │ 1.7 MB   │ +232 B  │
│ +0.26%   │ go.opentelemetry.io/auto/sdk                                  │ 89 kB    │ 89 kB    │ +231 B  │
│ +0.15%   │ k8s.io/klog/v2                                                │ 120 kB   │ 120 kB   │ +180 B  │
│ +0.10%   │ github.com/ulikunitz/xz                                       │ 180 kB   │ 180 kB   │ +176 B  │
│ +0.00%   │ k8s.io/client-go                                              │ 14 MB    │ 14 MB    │ +137 B  │
│ +0.04%   │ github.com/go-jose/go-jose/v4                                 │ 281 kB   │ 281 kB   │ +111 B  │
│ +7.12%   │ go/scanner                                                    │ 1.5 kB   │ 1.6 kB   │ +106 B  │
│ +0.01%   │ go.podman.io/storage                                          │ 1.6 MB   │ 1.6 MB   │ +94 B   │
│ +0.10%   │ golang.org/x/sys                                              │ 91 kB    │ 91 kB    │ +91 B   │
│ +0.00%   │ google.golang.org/protobuf                                    │ 1.8 MB   │ 1.8 MB   │ +72 B   │
│ +0.00%   │ crypto                                                        │ 1.9 MB   │ 1.9 MB   │ +61 B   │
│ +0.14%   │ vendor/golang.org/x/net/http2/hpack                           │ 35 kB    │ 35 kB    │ +50 B   │
│ +0.00%   │ golang.org/x/crypto                                           │ 758 kB   │ 758 kB   │ +36 B   │
│ +0.38%   │ internal/cpu                                                  │ 7.4 kB   │ 7.4 kB   │ +28 B   │
│ +0.02%   │ github.com/emicklei/go-restful/v3                             │ 132 kB   │ 132 kB   │ +27 B   │
│ +0.11%   │ vendor/golang.org/x/net/idna                                  │ 22 kB    │ 22 kB    │ +25 B   │
│ +0.01%   │ github.com/godbus/dbus/v5                                     │ 347 kB   │ 347 kB   │ +19 B   │
│ +0.01%   │ github.com/opencontainers/cgroups                             │ 142 kB   │ 142 kB   │ +15 B   │
│ +0.03%   │ k8s.io/utils                                                  │ 32 kB    │ 32 kB    │ +11 B   │
│ +0.01%   │ compress/flate                                                │ 72 kB    │ 72 kB    │ +10 B   │
│ +0.01%   │ github.com/coreos/go-systemd/v22                              │ 92 kB    │ 92 kB    │ +9 B    │
│ +0.01%   │ github.com/modern-go/reflect2                                 │ 149 kB   │ 149 kB   │ +9 B    │
│ +0.00%   │ github.com/spf13/cobra                                        │ 239 kB   │ 239 kB   │ +8 B    │
│ +0.02%   │ sigs.k8s.io/randfill                                          │ 36 kB    │ 36 kB    │ +8 B    │
│ +0.01%   │ mime                                                          │ 78 kB    │ 79 kB    │ +8 B    │
│ +0.04%   │ github.com/spf13/afero                                        │ 21 kB    │ 21 kB    │ +8 B    │
│ +0.01%   │ github.com/sigstore/protobuf-specs                            │ 55 kB    │ 55 kB    │ +7 B    │
│ +0.01%   │ github.com/spf13/cast                                         │ 107 kB   │ 107 kB   │ +6 B    │
│ +0.02%   │ github.com/distribution/reference                             │ 39 kB    │ 39 kB    │ +6 B    │
│ +0.00%   │ net                                                           │ 1.7 MB   │ 1.7 MB   │ +6 B    │
│ +0.01%   │ github.com/docker/distribution                                │ 53 kB    │ 53 kB    │ +6 B    │
│ +0.01%   │ gopkg.in/inf.v0                                               │ 35 kB    │ 35 kB    │ +4 B    │
│ +0.08%   │ google.golang.org/genproto/googleapis/rpc                     │ 5.1 kB   │ 5.1 kB   │ +4 B    │
│ +0.03%   │ github.com/go-openapi/swag                                    │ 10 kB    │ 10 kB    │ +3 B    │
│ +0.00%   │ github.com/spf13/viper                                        │ 73 kB    │ 73 kB    │ +3 B    │
│ +0.00%   │ github.com/cyphar/filepath-securejoin                         │ 88 kB    │ 88 kB    │ +2 B    │
│ +0.00%   │ github.com/sirupsen/logrus                                    │ 86 kB    │ 86 kB    │ +2 B    │
│ +0.00%   │ github.com/kevinburke/ssh_config                              │ 69 kB    │ 69 kB    │ +1 B    │
│ +0.01%   │ encoding/csv                                                  │ 13 kB    │ 13 kB    │ +1 B    │
│ +0.00%   │ github.com/containers/libtrust                                │ 65 kB    │ 65 kB    │ +1 B    │
│ +0.01%   │ github.com/pmezard/go-difflib                                 │ 17 kB    │ 17 kB    │ +1 B    │
│ +0.00%   │ html                                                          │ 136 kB   │ 136 kB   │ +1 B    │
│ +0.02%   │ internal/sysinfo                                              │ 4.1 kB   │ 4.2 kB   │ +1 B    │
│ -0.00%   │ bufio                                                         │ 39 kB    │ 39 kB    │ -1 B    │
│ -0.00%   │ text/template                                                 │ 292 kB   │ 292 kB   │ -1 B    │
│ -0.00%   │ encoding/xml                                                  │ 124 kB   │ 124 kB   │ -2 B    │
│ -0.00%   │ internal/sync                                                 │ 62 kB    │ 62 kB    │ -2 B    │
│ -0.01%   │ github.com/containerd/errdefs                                 │ 33 kB    │ 33 kB    │ -2 B    │
│ -0.00%   │ github.com/go-viper/mapstructure/v2                           │ 88 kB    │ 88 kB    │ -2 B    │
│ -0.01%   │ github.com/golang/protobuf                                    │ 34 kB    │ 34 kB    │ -3 B    │
│ -0.02%   │ github.com/quic-go/qpack                                      │ 22 kB    │ 22 kB    │ -4 B    │
│ -0.05%   │ expvar                                                        │ 11 kB    │ 11 kB    │ -5 B    │
│ -0.17%   │ github.com/mattn/go-sqlite3                                   │ 2.9 kB   │ 2.9 kB   │ -5 B    │
│ -0.01%   │ strings                                                       │ 58 kB    │ 58 kB    │ -6 B    │
│ -0.12%   │ github.com/opencontainers/runtime-tools                       │ 4.9 kB   │ 4.9 kB   │ -6 B    │
│ -0.00%   │ github.com/spf13/pflag                                        │ 302 kB   │ 302 kB   │ -6 B    │
│ -0.02%   │ github.com/mistifyio/go-zfs/v3                                │ 35 kB    │ 35 kB    │ -6 B    │
│ -0.03%   │ github.com/google/go-intervals                                │ 23 kB    │ 23 kB    │ -7 B    │
│ -0.00%   │ reflect                                                       │ 340 kB   │ 340 kB   │ -8 B    │
│ -0.01%   │ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp │ 74 kB    │ 74 kB    │ -8 B    │
│ -0.04%   │ encoding/base64                                               │ 20 kB    │ 20 kB    │ -9 B    │
│ -1.14%   │ github.com/moby/docker-image-spec                             │ 790 B    │ 781 B    │ -9 B    │
│ -0.00%   │ github.com/google/go-cmp                                      │ 297 kB   │ 297 kB   │ -9 B    │
│ -0.02%   │ github.com/sourcegraph/conc                                   │ 41 kB    │ 41 kB    │ -9 B    │
│ -0.01%   │ fmt                                                           │ 106 kB   │ 106 kB   │ -10 B   │
│ -0.00%   │ gopkg.in/yaml.v3                                              │ 306 kB   │ 306 kB   │ -11 B   │
│ -0.01%   │ os                                                            │ 221 kB   │ 221 kB   │ -12 B   │
│ -0.18%   │ github.com/modern-go/concurrent                               │ 7.0 kB   │ 7.0 kB   │ -13 B   │
│ -0.02%   │ image                                                         │ 90 kB    │ 90 kB    │ -14 B   │
│ -0.01%   │ github.com/fxamacker/cbor/v2                                  │ 300 kB   │ 300 kB   │ -17 B   │
│ -0.01%   │ github.com/BurntSushi/toml                                    │ 165 kB   │ 165 kB   │ -17 B   │
│ -0.01%   │ sigs.k8s.io/structured-merge-diff/v6                          │ 274 kB   │ 274 kB   │ -21 B   │
│ -0.11%   │ github.com/pkg/errors                                         │ 19 kB    │ 19 kB    │ -21 B   │
│ -0.03%   │ github.com/containers/podman/v5                               │ 116 kB   │ 116 kB   │ -37 B   │
│ -0.59%   │ vendor/golang.org/x/sys/cpu                                   │ 6.4 kB   │ 6.4 kB   │ -38 B   │
│ -0.15%   │ vendor/golang.org/x/crypto/cryptobyte                         │ 28 kB    │ 28 kB    │ -41 B   │
│ -0.06%   │ github.com/vbatts/tar-split                                   │ 84 kB    │ 84 kB    │ -53 B   │
│ -0.01%   │ github.com/json-iterator/go                                   │ 462 kB   │ 462 kB   │ -67 B   │
│ -1.74%   │ text/scanner                                                  │ 6.1 kB   │ 6.0 kB   │ -106 B  │
│ -0.03%   │ github.com/google/gnostic-models                              │ 1.6 MB   │ 1.6 MB   │ -454 B  │
│ -1.36%   │ bytes                                                         │ 42 kB    │ 42 kB    │ -574 B  │
│ -0.68%   │ go.yaml.in/yaml/v2                                            │ 277 kB   │ 275 kB   │ -1.9 kB │
│ -45.16%  │ github.com/docker/go-connections                              │ 13 kB    │ 7.3 kB   │ -6.0 kB │
│ -13.92%  │ github.com/gabriel-vasile/mimetype                            │ 213 kB   │ 184 kB   │ -30 kB  │
│ -91.54%  │ github.com/docker/docker                                      │ 486 kB   │ 41 kB    │ -445 kB │
├──────────┼───────────────────────────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ +1.13%   │ .rodata                                                       │ 2.3 MB   │ 2.4 MB   │ +26 kB  │
│ +0.99%   │ .data                                                         │ 262 kB   │ 264 kB   │ +2.6 kB │
│ +0.04%   │ .noptrdata                                                    │ 827 kB   │ 827 kB   │ +352 B  │
├──────────┼───────────────────────────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ +1.47%   │ sablier                                                       │ 66 MB    │ 67 MB    │ +963 kB │
│          │ sablier                                                       │          │          │         │
└──────────┴───────────────────────────────────────────────────────────────┴──────────┴──────────┴─────────┘

@acouvreur acouvreur marked this pull request as draft November 27, 2025 17:04
@acouvreur acouvreur marked this pull request as ready for review May 7, 2026 12:11
@github-actions github-actions Bot added the ci label May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test Results

✅ All tests passed! | 194 tests in 174.934s

View HTML Test Report

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@acouvreur acouvreur merged commit a5babb9 into main May 7, 2026
8 checks passed
@acouvreur acouvreur deleted the use-moby-client branch May 7, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci provider Issue related to a provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants