From be03dc9ce72698059c1731b80ce99ddccb48a2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 16 May 2025 18:52:28 +0200 Subject: [PATCH 1/2] vendor: github.com/docker/docker v28.2.0-dev (b45aa469cac7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit full diff: https://github.com/docker/docker/compare/c04dec11437f...b45aa469cac7 Signed-off-by: Paweł Gronowski --- cli/command/builder/client_test.go | 6 +- cli/command/builder/prune.go | 4 +- cli/command/builder/prune_test.go | 4 +- vendor.mod | 2 +- vendor.sum | 4 +- vendor/github.com/docker/docker/api/common.go | 2 +- .../github.com/docker/docker/api/swagger.yaml | 34 ++++- .../docker/docker/api/types/build/cache.go | 24 +++- .../docker/docker/api/types/system/info.go | 10 ++ .../docker/docker/api/types/types.go | 25 +--- .../docker/api/types/types_deprecated.go | 17 +++ .../docker/docker/client/build_prune.go | 6 +- .../docker/docker/client/client_interfaces.go | 3 +- .../github.com/docker/docker/client/errors.go | 8 +- .../github.com/docker/docker/errdefs/doc.go | 2 +- vendor/github.com/docker/docker/errdefs/is.go | 127 ++++++------------ vendor/modules.txt | 2 +- 17 files changed, 145 insertions(+), 135 deletions(-) diff --git a/cli/command/builder/client_test.go b/cli/command/builder/client_test.go index 6214dcf30d8b..e1cdedd133c9 100644 --- a/cli/command/builder/client_test.go +++ b/cli/command/builder/client_test.go @@ -3,16 +3,16 @@ package builder import ( "context" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/build" "github.com/docker/docker/client" ) type fakeClient struct { client.Client - builderPruneFunc func(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) + builderPruneFunc func(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) } -func (c *fakeClient) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { +func (c *fakeClient) BuildCachePrune(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) { if c.builderPruneFunc != nil { return c.builderPruneFunc(ctx, opts) } diff --git a/cli/command/builder/prune.go b/cli/command/builder/prune.go index 8173a6d9b127..ab04ea359735 100644 --- a/cli/command/builder/prune.go +++ b/cli/command/builder/prune.go @@ -11,7 +11,7 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/internal/prompt" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/build" "github.com/docker/docker/errdefs" units "github.com/docker/go-units" "github.com/spf13/cobra" @@ -79,7 +79,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) } } - report, err := dockerCli.Client().BuildCachePrune(ctx, types.BuildCachePruneOptions{ + report, err := dockerCli.Client().BuildCachePrune(ctx, build.CachePruneOptions{ All: options.all, KeepStorage: options.keepStorage.Value(), // FIXME(thaJeztah): rewrite to use new options; see https://github.com/moby/moby/pull/48720 Filters: pruneFilters, diff --git a/cli/command/builder/prune_test.go b/cli/command/builder/prune_test.go index 7fb18900da50..e0c3097b07e2 100644 --- a/cli/command/builder/prune_test.go +++ b/cli/command/builder/prune_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/build" ) func TestBuilderPromptTermination(t *testing.T) { @@ -15,7 +15,7 @@ func TestBuilderPromptTermination(t *testing.T) { t.Cleanup(cancel) cli := test.NewFakeCli(&fakeClient{ - builderPruneFunc: func(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { + builderPruneFunc: func(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) { return nil, errors.New("fakeClient builderPruneFunc should not be called") }, }) diff --git a/vendor.mod b/vendor.mod index 3d1425eef8ea..9f8e1517f265 100644 --- a/vendor.mod +++ b/vendor.mod @@ -15,7 +15,7 @@ require ( github.com/distribution/reference v0.6.0 github.com/docker/cli-docs-tool v0.9.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v28.1.2-0.20250516114456-c04dec11437f+incompatible // master, v28.x dev + github.com/docker/docker v28.1.2-0.20250516164234-b45aa469cac7+incompatible // master, v28.x dev github.com/docker/docker-credential-helpers v0.9.3 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index dcedb66a5b2d..3b57d135f55a 100644 --- a/vendor.sum +++ b/vendor.sum @@ -55,8 +55,8 @@ github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3T github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.1.2-0.20250516114456-c04dec11437f+incompatible h1:0jSTstSvJ1S0l/wH/vJ5JMnsSNpWx6dmqblTwe87dVc= -github.com/docker/docker v28.1.2-0.20250516114456-c04dec11437f+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.1.2-0.20250516164234-b45aa469cac7+incompatible h1:xtuKFtxaqylpM2HVDGIJn11TYgIbo7B6aW+PwVFvZj8= +github.com/docker/docker v28.1.2-0.20250516164234-b45aa469cac7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/docker/api/common.go b/vendor/github.com/docker/docker/api/common.go index d75c43d7c16d..c375c68f2ad6 100644 --- a/vendor/github.com/docker/docker/api/common.go +++ b/vendor/github.com/docker/docker/api/common.go @@ -3,7 +3,7 @@ package api // import "github.com/docker/docker/api" // Common constants for daemon and client. const ( // DefaultVersion of the current REST API. - DefaultVersion = "1.49" + DefaultVersion = "1.50" // MinSupportedAPIVersion is the minimum API version that can be supported // by the API server, specified as "major.minor". Note that the daemon diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index 1183aaf2b59d..5a17aed5c08c 100644 --- a/vendor/github.com/docker/docker/api/swagger.yaml +++ b/vendor/github.com/docker/docker/api/swagger.yaml @@ -19,10 +19,10 @@ produces: consumes: - "application/json" - "text/plain" -basePath: "/v1.49" +basePath: "/v1.50" info: title: "Docker Engine API" - version: "1.49" + version: "1.50" x-logo: url: "https://docs.docker.com/assets/images/logo-docker-main.png" description: | @@ -55,8 +55,8 @@ info: the URL is not supported by the daemon, a HTTP `400 Bad Request` error message is returned. - If you omit the version-prefix, the current version of the API (v1.49) is used. - For example, calling `/info` is the same as calling `/v1.49/info`. Using the + If you omit the version-prefix, the current version of the API (v1.50) is used. + For example, calling `/info` is the same as calling `/v1.50/info`. Using the API without a version-prefix is deprecated and will be removed in a future release. Engine releases in the near future should support this version of the API, @@ -2956,6 +2956,23 @@ definitions: progressDetail: $ref: "#/definitions/ProgressDetail" + DeviceInfo: + type: "object" + description: | + DeviceInfo represents a device that can be used by a container. + properties: + Source: + type: "string" + example: "cdi" + description: | + The origin device driver. + ID: + type: "string" + example: "vendor.com/gpu=0" + description: | + The unique identifier for the device within its source driver. + For CDI devices, this would be an FQDN like "vendor.com/gpu=0". + ErrorDetail: type: "object" properties: @@ -6858,6 +6875,15 @@ definitions: example: "24" FirewallBackend: $ref: "#/definitions/FirewallInfo" + DiscoveredDevices: + description: | + List of devices discovered by device drivers. + + Each device includes information about its source driver, kind, name, + and additional driver-specific attributes. + type: "array" + items: + $ref: "#/definitions/DeviceInfo" Warnings: description: | List of warnings / informational messages about missing features, or diff --git a/vendor/github.com/docker/docker/api/types/build/cache.go b/vendor/github.com/docker/docker/api/types/build/cache.go index ffc826caa8e3..42c840457364 100644 --- a/vendor/github.com/docker/docker/api/types/build/cache.go +++ b/vendor/github.com/docker/docker/api/types/build/cache.go @@ -1,6 +1,10 @@ package build -import "time" +import ( + "time" + + "github.com/docker/docker/api/types/filters" +) // CacheRecord contains information about a build cache record. type CacheRecord struct { @@ -28,3 +32,21 @@ type CacheRecord struct { LastUsedAt *time.Time UsageCount int } + +// CachePruneOptions hold parameters to prune the build cache. +type CachePruneOptions struct { + All bool + ReservedSpace int64 + MaxUsedSpace int64 + MinFreeSpace int64 + Filters filters.Args + + KeepStorage int64 // Deprecated: deprecated in API 1.48. +} + +// CachePruneReport contains the response for Engine API: +// POST "/build/prune" +type CachePruneReport struct { + CachesDeleted []string + SpaceReclaimed uint64 +} diff --git a/vendor/github.com/docker/docker/api/types/system/info.go b/vendor/github.com/docker/docker/api/types/system/info.go index 27173d4630a5..aac43f581905 100644 --- a/vendor/github.com/docker/docker/api/types/system/info.go +++ b/vendor/github.com/docker/docker/api/types/system/info.go @@ -75,6 +75,7 @@ type Info struct { DefaultAddressPools []NetworkAddressPool `json:",omitempty"` FirewallBackend *FirewallInfo `json:"FirewallBackend,omitempty"` CDISpecDirs []string + DiscoveredDevices []DeviceInfo `json:",omitempty"` Containerd *ContainerdInfo `json:",omitempty"` @@ -160,3 +161,12 @@ type FirewallInfo struct { // Info is a list of label/value pairs, containing information related to the firewall. Info [][2]string `json:"Info,omitempty"` } + +// DeviceInfo represents a discoverable device from a device driver. +type DeviceInfo struct { + // Source indicates the origin device driver. + Source string `json:"Source"` + // ID is the unique identifier for the device. + // Example: CDI FQDN like "vendor.com/gpu=0", or other driver-specific device ID + ID string `json:"ID"` +} diff --git a/vendor/github.com/docker/docker/api/types/types.go b/vendor/github.com/docker/docker/api/types/types.go index 9361c8531efe..891fe80bdfc7 100644 --- a/vendor/github.com/docker/docker/api/types/types.go +++ b/vendor/github.com/docker/docker/api/types/types.go @@ -90,17 +90,10 @@ type DiskUsage struct { Images []*image.Summary Containers []*container.Summary Volumes []*volume.Volume - BuildCache []*BuildCache + BuildCache []*build.CacheRecord BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40. } -// BuildCachePruneReport contains the response for Engine API: -// POST "/build/prune" -type BuildCachePruneReport struct { - CachesDeleted []string - SpaceReclaimed uint64 -} - // SecretCreateResponse contains the information returned to a client // on the creation of a new secret. type SecretCreateResponse struct { @@ -138,19 +131,3 @@ type PushResult struct { type BuildResult struct { ID string } - -// BuildCache contains information about a build cache record. -// -// Deprecated: deprecated in API 1.49. Use [build.CacheRecord] instead. -type BuildCache = build.CacheRecord - -// BuildCachePruneOptions hold parameters to prune the build cache -type BuildCachePruneOptions struct { - All bool - ReservedSpace int64 - MaxUsedSpace int64 - MinFreeSpace int64 - Filters filters.Args - - KeepStorage int64 // Deprecated: deprecated in API 1.48. -} diff --git a/vendor/github.com/docker/docker/api/types/types_deprecated.go b/vendor/github.com/docker/docker/api/types/types_deprecated.go index 93e4336adcb6..c3886841dbaa 100644 --- a/vendor/github.com/docker/docker/api/types/types_deprecated.go +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -3,6 +3,7 @@ package types import ( "context" + "github.com/docker/docker/api/types/build" "github.com/docker/docker/api/types/common" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" @@ -113,3 +114,19 @@ type ImageInspect = image.InspectResponse // // Deprecated: moved to [github.com/docker/docker/api/types/registry.RequestAuthConfig]. type RequestPrivilegeFunc func(context.Context) (string, error) + +// BuildCache contains information about a build cache record. +// +// Deprecated: deprecated in API 1.49. Use [build.CacheRecord] instead. +type BuildCache = build.CacheRecord + +// BuildCachePruneOptions hold parameters to prune the build cache +// +// Deprecated: use [build.CachePruneOptions]. +type BuildCachePruneOptions = build.CachePruneOptions + +// BuildCachePruneReport contains the response for Engine API: +// POST "/build/prune" +// +// Deprecated: use [build.CachePruneReport]. +type BuildCachePruneReport = build.CachePruneReport diff --git a/vendor/github.com/docker/docker/client/build_prune.go b/vendor/github.com/docker/docker/client/build_prune.go index 92b47d18384f..db8fad55d3ec 100644 --- a/vendor/github.com/docker/docker/client/build_prune.go +++ b/vendor/github.com/docker/docker/client/build_prune.go @@ -6,13 +6,13 @@ import ( "net/url" "strconv" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/build" "github.com/docker/docker/api/types/filters" "github.com/pkg/errors" ) // BuildCachePrune requests the daemon to delete unused cache data -func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { +func (cli *Client) BuildCachePrune(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) { if err := cli.NewVersionError(ctx, "1.31", "build prune"); err != nil { return nil, err } @@ -47,7 +47,7 @@ func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePru return nil, err } - report := types.BuildCachePruneReport{} + report := build.CachePruneReport{} if err := json.NewDecoder(resp.Body).Decode(&report); err != nil { return nil, errors.Wrap(err, "error retrieving disk usage") } diff --git a/vendor/github.com/docker/docker/client/client_interfaces.go b/vendor/github.com/docker/docker/client/client_interfaces.go index f70d8ffa01ab..2ade8572a8b8 100644 --- a/vendor/github.com/docker/docker/client/client_interfaces.go +++ b/vendor/github.com/docker/docker/client/client_interfaces.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/build" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/events" "github.com/docker/docker/api/types/filters" @@ -110,7 +111,7 @@ type DistributionAPIClient interface { // ImageAPIClient defines API client methods for the images type ImageAPIClient interface { ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) - BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) + BuildCachePrune(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) BuildCancel(ctx context.Context, id string) error ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) ImageImport(ctx context.Context, source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) diff --git a/vendor/github.com/docker/docker/client/errors.go b/vendor/github.com/docker/docker/client/errors.go index 609f92ce662e..d19d836208b5 100644 --- a/vendor/github.com/docker/docker/client/errors.go +++ b/vendor/github.com/docker/docker/client/errors.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" + cerrdefs "github.com/containerd/errdefs" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/errdefs" ) // errConnectionFailed implements an error returned when connection failed. @@ -48,9 +48,11 @@ func connectionFailed(host string) error { } // IsErrNotFound returns true if the error is a NotFound error, which is returned -// by the API when some object is not found. It is an alias for [errdefs.IsNotFound]. +// by the API when some object is not found. It is an alias for [cerrdefs.IsNotFound]. +// +// Deprecated: use [cerrdefs.IsNotFound] instead. func IsErrNotFound(err error) bool { - return errdefs.IsNotFound(err) + return cerrdefs.IsNotFound(err) } type objectNotFoundError struct { diff --git a/vendor/github.com/docker/docker/errdefs/doc.go b/vendor/github.com/docker/docker/errdefs/doc.go index c211f174fc11..b8d32eb484bd 100644 --- a/vendor/github.com/docker/docker/errdefs/doc.go +++ b/vendor/github.com/docker/docker/errdefs/doc.go @@ -4,5 +4,5 @@ // Packages should not reference these interfaces directly, only implement them. // To check if a particular error implements one of these interfaces, there are helper // functions provided (e.g. `Is`) which can be used rather than asserting the interfaces directly. -// If you must assert on these interfaces, be sure to check the causal chain (`err.Cause()`). +// If you must assert on these interfaces, be sure to check the causal chain (`err.Unwrap()`). package errdefs // import "github.com/docker/docker/errdefs" diff --git a/vendor/github.com/docker/docker/errdefs/is.go b/vendor/github.com/docker/docker/errdefs/is.go index 30ea7e6fec2f..ceb754a954f7 100644 --- a/vendor/github.com/docker/docker/errdefs/is.go +++ b/vendor/github.com/docker/docker/errdefs/is.go @@ -3,119 +3,74 @@ package errdefs import ( "context" "errors" -) - -type causer interface { - Cause() error -} - -type wrapErr interface { - Unwrap() error -} -func getImplementer(err error) error { - switch e := err.(type) { - case - ErrNotFound, - ErrInvalidParameter, - ErrConflict, - ErrUnauthorized, - ErrUnavailable, - ErrForbidden, - ErrSystem, - ErrNotModified, - ErrNotImplemented, - ErrCancelled, - ErrDeadline, - ErrDataLoss, - ErrUnknown: - return err - case causer: - return getImplementer(e.Cause()) - case wrapErr: - return getImplementer(e.Unwrap()) - default: - return err - } -} + cerrdefs "github.com/containerd/errdefs" +) // IsNotFound returns if the passed in error is an [ErrNotFound], -func IsNotFound(err error) bool { - _, ok := getImplementer(err).(ErrNotFound) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsNotFound] +var IsNotFound = cerrdefs.IsNotFound // IsInvalidParameter returns if the passed in error is an [ErrInvalidParameter]. -func IsInvalidParameter(err error) bool { - _, ok := getImplementer(err).(ErrInvalidParameter) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsInvalidArgument] +var IsInvalidParameter = cerrdefs.IsInvalidArgument // IsConflict returns if the passed in error is an [ErrConflict]. -func IsConflict(err error) bool { - _, ok := getImplementer(err).(ErrConflict) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsConflict] +var IsConflict = cerrdefs.IsConflict // IsUnauthorized returns if the passed in error is an [ErrUnauthorized]. -func IsUnauthorized(err error) bool { - _, ok := getImplementer(err).(ErrUnauthorized) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsUnauthorized] +var IsUnauthorized = cerrdefs.IsUnauthorized // IsUnavailable returns if the passed in error is an [ErrUnavailable]. -func IsUnavailable(err error) bool { - _, ok := getImplementer(err).(ErrUnavailable) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsUnavailable] +var IsUnavailable = cerrdefs.IsUnavailable // IsForbidden returns if the passed in error is an [ErrForbidden]. -func IsForbidden(err error) bool { - _, ok := getImplementer(err).(ErrForbidden) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsPermissionDenied] +var IsForbidden = cerrdefs.IsPermissionDenied // IsSystem returns if the passed in error is an [ErrSystem]. -func IsSystem(err error) bool { - _, ok := getImplementer(err).(ErrSystem) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsInternal] +var IsSystem = cerrdefs.IsInternal // IsNotModified returns if the passed in error is an [ErrNotModified]. -func IsNotModified(err error) bool { - _, ok := getImplementer(err).(ErrNotModified) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsNotModified] +var IsNotModified = cerrdefs.IsNotModified // IsNotImplemented returns if the passed in error is an [ErrNotImplemented]. -func IsNotImplemented(err error) bool { - _, ok := getImplementer(err).(ErrNotImplemented) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsNotImplemented] +var IsNotImplemented = cerrdefs.IsNotImplemented // IsUnknown returns if the passed in error is an [ErrUnknown]. -func IsUnknown(err error) bool { - _, ok := getImplementer(err).(ErrUnknown) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsUnknown] +var IsUnknown = cerrdefs.IsUnknown // IsCancelled returns if the passed in error is an [ErrCancelled]. -func IsCancelled(err error) bool { - _, ok := getImplementer(err).(ErrCancelled) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsCanceled] +var IsCancelled = cerrdefs.IsCanceled // IsDeadline returns if the passed in error is an [ErrDeadline]. -func IsDeadline(err error) bool { - _, ok := getImplementer(err).(ErrDeadline) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsDeadlineExceeded] +var IsDeadline = cerrdefs.IsDeadlineExceeded // IsDataLoss returns if the passed in error is an [ErrDataLoss]. -func IsDataLoss(err error) bool { - _, ok := getImplementer(err).(ErrDataLoss) - return ok -} +// +// Deprecated: use containerd [cerrdefs.IsDataLoss] +var IsDataLoss = cerrdefs.IsDataLoss // IsContext returns if the passed in error is due to context cancellation or deadline exceeded. func IsContext(err error) bool { diff --git a/vendor/modules.txt b/vendor/modules.txt index 18b52a027bb0..d05fab8ae473 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v28.1.2-0.20250516114456-c04dec11437f+incompatible +# github.com/docker/docker v28.1.2-0.20250516164234-b45aa469cac7+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types From f6a077a8318c1911c4e518a212287b08eb22c8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 16 May 2025 19:21:26 +0200 Subject: [PATCH 2/2] system/info: Show discovered devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- cli/command/system/info.go | 7 +++ cli/command/system/info_test.go | 14 +++++ .../testdata/docker-info-with-devices.golden | 60 +++++++++++++++++++ .../docker-info-with-devices.json.golden | 1 + 4 files changed, 82 insertions(+) create mode 100644 cli/command/system/testdata/docker-info-with-devices.golden create mode 100644 cli/command/system/testdata/docker-info-with-devices.json.golden diff --git a/cli/command/system/info.go b/cli/command/system/info.go index 9f77cf42f777..7f82e4e5d85f 100644 --- a/cli/command/system/info.go +++ b/cli/command/system/info.go @@ -281,6 +281,13 @@ func prettyPrintServerInfo(streams command.Streams, info *dockerInfo) []error { } } + if len(info.DiscoveredDevices) > 0 { + fprintln(output, " Discovered Devices:") + for _, device := range info.DiscoveredDevices { + fprintf(output, " %s: %s\n", device.Source, device.ID) + } + } + fprintln(output, " Swarm:", info.Swarm.LocalNodeState) printSwarmInfo(output, *info.Info) diff --git a/cli/command/system/info_test.go b/cli/command/system/info_test.go index 5ff0787422a2..d996ea23f49a 100644 --- a/cli/command/system/info_test.go +++ b/cli/command/system/info_test.go @@ -260,6 +260,12 @@ func TestPrettyPrintInfo(t *testing.T) { sampleInfoLabelsEmpty := sampleInfoNoSwarm sampleInfoLabelsEmpty.Labels = []string{} + sampleInfoWithDevices := sampleInfoNoSwarm + sampleInfoWithDevices.DiscoveredDevices = []system.DeviceInfo{ + {Source: "cdi", ID: "com.example.device1"}, + {Source: "cdi", ID: "nvidia.com/gpu=gpu0"}, + } + for _, tc := range []struct { doc string dockerInfo dockerInfo @@ -366,6 +372,14 @@ func TestPrettyPrintInfo(t *testing.T) { warningsGolden: "docker-info-badsec-stderr", expectedError: "errors pretty printing info", }, + { + doc: "info with devices", + dockerInfo: dockerInfo{ + Info: &sampleInfoWithDevices, + }, + prettyGolden: "docker-info-with-devices", + jsonGolden: "docker-info-with-devices", + }, } { t.Run(tc.doc, func(t *testing.T) { cli := test.NewFakeCli(&fakeClient{}) diff --git a/cli/command/system/testdata/docker-info-with-devices.golden b/cli/command/system/testdata/docker-info-with-devices.golden new file mode 100644 index 000000000000..ab9b9b9011da --- /dev/null +++ b/cli/command/system/testdata/docker-info-with-devices.golden @@ -0,0 +1,60 @@ +Client: + +Server: + Containers: 0 + Running: 0 + Paused: 0 + Stopped: 0 + Images: 0 + Server Version: 17.06.1-ce + Storage Driver: overlay2 + Backing Filesystem: extfs + Supports d_type: true + Using metacopy: false + Native Overlay Diff: true + Logging Driver: json-file + Cgroup Driver: cgroupfs + Plugins: + Volume: local + Network: bridge host macvlan null overlay + Log: awslogs fluentd gcplogs gelf journald json-file splunk syslog + CDI spec directories: + /etc/cdi + /var/run/cdi + Discovered Devices: + cdi: com.example.device1 + cdi: nvidia.com/gpu=gpu0 + Swarm: inactive + Runtimes: runc + Default Runtime: runc + Init Binary: docker-init + containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170 + runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2 + init version: 949e6fa + Security Options: + apparmor + seccomp + Profile: default + Kernel Version: 4.4.0-87-generic + Operating System: Ubuntu 16.04.3 LTS + OSType: linux + Architecture: x86_64 + CPUs: 2 + Total Memory: 1.953GiB + Name: system-sample + ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX + Docker Root Dir: /var/lib/docker + Debug Mode: true + File Descriptors: 33 + Goroutines: 135 + System Time: 2017-08-24T17:44:34.077811894Z + EventsListeners: 0 + Labels: + provider=digitalocean + Experimental: false + Insecure Registries: + 127.0.0.0/8 + Live Restore Enabled: false + Default Address Pools: + Base: 10.123.0.0/16, Size: 24 + diff --git a/cli/command/system/testdata/docker-info-with-devices.json.golden b/cli/command/system/testdata/docker-info-with-devices.json.golden new file mode 100644 index 000000000000..cff9678eea72 --- /dev/null +++ b/cli/command/system/testdata/docker-info-with-devices.json.golden @@ -0,0 +1 @@ +{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"overlay2","DriverStatus":[["Backing Filesystem","extfs"],["Supports d_type","true"],["Using metacopy","false"],["Native Overlay Diff","true"]],"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"PidsLimit":false,"IPv4Forwarding":true,"BridgeNfIptables":false,"BridgeNfIp6tables":false,"Debug":true,"NFd":33,"OomKillDisable":true,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSVersion":"","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"IndexConfigs":{"docker.io":{"Mirrors":null,"Name":"docker.io","Official":true,"Secure":true}},"InsecureRegistryCIDRs":["127.0.0.0/8"],"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=apparmor","name=seccomp,profile=default"],"DefaultAddressPools":[{"Base":"10.123.0.0/16","Size":24}],"CDISpecDirs":["/etc/cdi","/var/run/cdi"],"DiscoveredDevices":[{"Source":"cdi","ID":"com.example.device1"},{"Source":"cdi","ID":"nvidia.com/gpu=gpu0"}],"Warnings":null}