-
Notifications
You must be signed in to change notification settings - Fork 2.1k
vendor: github.com/moby/moby/api master, moby/client master #6620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vendor: github.com/moby/moby/api master, moby/client master #6620
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Hmm, I guess it needs to also handle the case for older API versions. |
cli/command/formatter/disk_usage.go
Outdated
| ImageData struct { | ||
| TotalCount int64 | ||
| ActiveCount int64 | ||
| TotalSize int64 | ||
| Reclaimable int64 | ||
| Images []image.Summary | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked in-depth, but wondering if instead of defining our own structs in the CLI, if we could use the ones returned by the client directly?
At a quick glance, the difference is that these defined here use Images, Records, Containers as filename for the items, and the client uses a more generic Items. If that's the only difference, then, perhaps we can just adopt the type(s) as-is somehow?
c141d63 to
b8668f7
Compare
c539ada to
575d58e
Compare
|
Something seems borked in this PR (or in the client); This is against the same daemon with v28.5; docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 24 10 30.83GB 29.65GB (96%)
Containers 16 3 397.3kB 188.4kB (47%)
Local Volumes 7 3 7.078GB 6.308GB (89%)
Build Cache 517 0 21.44GB 21.44GBand with this PR; docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 0 0 30.83GB 0B (0%)
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B |
|
Right, so a quick check to see what summaries the client returns, and I get this; index 2c689da020..e5222f2d66 100644
--- a/cli/command/system/df.go
+++ b/cli/command/system/df.go
@@ -2,6 +2,8 @@
import (
"context"
+ "encoding/json"
+ "fmt"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
@@ -54,6 +56,15 @@ func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts diskUsageOpti
format = formatter.TableFormatKey
}
+ du2 := du
+ du2.Images.Items = nil
+ du2.BuildCache.Items = nil
+ du2.Containers.Items = nil
+ du2.Volumes.Items = nil
+
+ out, _ := json.Marshal(&du2)
+ fmt.Println(string(out))
+
duCtx := formatter.DiskUsageContext{
Context: formatter.Context{
Output: dockerCli.Out(),{
"Containers": {
"ActiveContainers": 0,
"TotalContainers": 0,
"Reclaimable": 0,
"TotalSize": 0,
"Items": null
},
"Images": {
"ActiveImages": 0,
"TotalImages": 0,
"Reclaimable": 0,
"TotalSize": 30827314805,
"Items": null
},
"BuildCache": {
"ActiveBuildCacheRecords": 0,
"TotalBuildCacheRecords": 0,
"Reclaimable": 0,
"TotalSize": 0,
"Items": null
},
"Volumes": {
"ActiveVolumes": 0,
"TotalVolumes": 0,
"Reclaimable": 0,
"TotalSize": 0,
"Items": null
}
}So it looks like the client doesn't calculate the totals |
| func convertLegacyUsage(du system.DiskUsage) system.DiskUsage { | ||
| out := system.DiskUsage{ | ||
| ImageUsage: &system.ImagesDiskUsage{ | ||
| TotalSize: du.LayersSize, | ||
| TotalImages: int64(len(du.Images)), | ||
| Items: du.Images, | ||
| }, | ||
| ContainerUsage: &system.ContainersDiskUsage{ | ||
| TotalContainers: int64(len(du.Containers)), | ||
| Items: du.Containers, | ||
| }, | ||
| VolumeUsage: &system.VolumesDiskUsage{ | ||
| TotalVolumes: int64(len(du.Volumes)), | ||
| Items: du.Volumes, | ||
| }, | ||
| BuildCacheUsage: &system.BuildCacheDiskUsage{ | ||
| TotalBuildCacheRecords: int64(len(du.BuildCache)), | ||
| Items: du.BuildCache, | ||
| }, | ||
| } | ||
| for _, img := range du.Images { | ||
| if img == nil { | ||
| continue | ||
| } | ||
| var size int64 | ||
| if img.Size >= 0 && img.SharedSize >= 0 { | ||
| size = (img.Size - img.SharedSize) | ||
| } | ||
|
|
||
| if img.Containers > 0 { | ||
| out.ImageUsage.ActiveImages++ | ||
| // FIXME(thaJeztah): this doesn't match the old output. | ||
| if out.ImageUsage.TotalSize > 0 { | ||
| out.ImageUsage.Reclaimable -= size | ||
| } | ||
| } else { | ||
| out.ImageUsage.Reclaimable += size | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Monkey-patching vendor, but values don't match yet;
Getting this;
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 24 10 30.83GB 4.192GB (13%)
Containers 16 0 0B 0B
Local Volumes 7 0 0B 0B
Build Cache 517 0 0B 0B
Instead of
docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 24 9 30.83GB 30.43GB (98%)
Containers 15 2 274.4kB 188.4kB (68%)
Local Volumes 7 2 7.237GB 7.195GB (99%)
Build Cache 517 0 21.44GB 21.44GBa0b1dc3 to
07a5275
Compare
403327f to
60ebc09
Compare
|
New Old |
60ebc09 to
9de7215
Compare
|
New Old |
9de7215 to
776730b
Compare
There was a problem hiding this 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 PR updates the vendored dependencies for github.com/moby/moby/api and github.com/moby/moby/client to the latest master branch commits (as of November 6, 2025). The changes adapt the codebase to API modifications in the updated dependencies, primarily involving type conversions, method renaming, and structural updates to disk usage reporting.
- Type changes: Several string fields changed to typed constants requiring explicit conversions (e.g.,
FailureAction,UpdateOrder,RegistryAuthSource) - API method renames: Prune methods changed from plural to singular forms (e.g.,
ImagesPrune→ImagePrune) - Structural changes: Result types changed from structs to interfaces, requiring updated mock implementations and disk usage context handling
Reviewed Changes
Copilot reviewed 25 out of 54 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vendor.sum | Updates checksums for the new moby/moby/api and moby/moby/client versions |
| vendor.mod | Updates version references to pseudo-versions pointing to master branch commits |
| cli/compose/convert/service.go | Adds type conversions for FailureAction and UpdateOrder fields |
| cli/compose/convert/service_test.go | Converts UpdateOrder to string for test assertions |
| cli/command/volume/prune.go | Renames method call from VolumesPrune to VolumePrune |
| cli/command/volume/client_test.go | Updates test mock method from VolumesPrune to VolumePrune |
| cli/command/system/df.go | Updates disk usage API call to use new Verbose option and restructured context fields |
| cli/command/system/client_test.go | Renames test mock method from ContainersPrune to ContainerPrune |
| cli/command/service/update.go | Adds type conversions for service update and rollback configuration fields |
| cli/command/service/opts_test.go | Converts typed constants to strings for test flag setting and assertions |
| cli/command/service/opts.go | Adds type conversions for update and rollback configuration options |
| cli/command/service/formatter.go | Converts typed fields to strings for display formatting |
| cli/command/network/prune.go | Renames method call from NetworksPrune to NetworkPrune |
| cli/command/image/save_test.go | Changes mock return type from struct to io.ReadCloser |
| cli/command/image/prune_test.go | Renames test function field from imagesPruneFunc to imagePruneFunc |
| cli/command/image/prune.go | Renames method call from ImagesPrune to ImagePrune |
| cli/command/image/load_test.go | Removes reflection-based mock and returns io.ReadCloser directly |
| cli/command/image/import_test.go | Changes mock return type from struct to io.ReadCloser |
| cli/command/image/client_test.go | Updates test client methods to use new API signatures and return types |
| cli/command/formatter/disk_usage.go | Restructures disk usage context to use new client types instead of calculating locally |
| cli/command/formatter/buildcache.go | Changes function signatures from pointer slices to value slices |
| cli/command/container/prune.go | Renames method call from ContainersPrune to ContainerPrune |
| cli/command/container/exec_test.go | Renames field from Tty to TTY |
| cli/command/container/exec.go | Updates exec implementation to use renamed TTY field and new ConsoleSize structure |
| cli/command/container/client_test.go | Removes reflection-based mocks and updates method signatures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| github.com/moby/go-archive v0.1.0 | ||
| github.com/moby/moby/api v1.52.0-beta.4 | ||
| github.com/moby/moby/client v0.1.0-beta.3 | ||
| github.com/moby/moby/api v1.52.0-beta.4.0.20251106210608-f7fd9c315acf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs 217fd7890581
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, let's wait for the api/client to be tagged upstream
776730b to
de0b8d1
Compare
Signed-off-by: Austin Vazquez <[email protected]>
de0b8d1 to
5039eee
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- What I did
This change vendors the tip of master branch (moby/moby@217fd78) for github.com/moby/moby/api and github.com/moby/moby/client.
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)