From 68dac842a1faa93114358eb516f7451fa47184c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 24 Jan 2024 14:20:11 +0100 Subject: [PATCH 1/2] vendor: github.com/docker/docker 43ffb1ee9d5a (v26.0.0-dev) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit full diff: https://github.com/docker/docker/compare/v25.0.0...43ffb1ee9d5a Signed-off-by: Paweł Gronowski --- vendor.mod | 2 +- vendor.sum | 4 +- vendor/github.com/docker/docker/api/common.go | 2 +- .../github.com/docker/docker/api/swagger.yaml | 12 +- .../docker/docker/api/types/client.go | 47 ------ .../docker/docker/api/types/image/opts.go | 58 +++++++- .../docker/docker/api/types/mount/mount.go | 1 + .../docker/api/types/types_deprecated.go | 139 +++--------------- .../docker/client/distribution_inspect.go | 8 +- .../docker/docker/client/image_create.go | 4 +- .../docker/docker/client/image_import.go | 3 +- .../docker/docker/client/image_list.go | 3 +- .../docker/docker/client/image_pull.go | 4 +- .../docker/docker/client/image_push.go | 4 +- .../docker/docker/client/image_remove.go | 3 +- .../docker/docker/client/interface.go | 12 +- .../docker/docker/pkg/homedir/homedir.go | 16 -- .../docker/docker/pkg/homedir/homedir_unix.go | 8 - .../docker/pkg/homedir/homedir_windows.go | 6 - .../docker/pkg/system/image_os_deprecated.go | 19 --- vendor/modules.txt | 2 +- 21 files changed, 105 insertions(+), 252 deletions(-) delete mode 100644 vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go delete mode 100644 vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go delete mode 100644 vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go diff --git a/vendor.mod b/vendor.mod index 1ee7243740..4df3e08960 100644 --- a/vendor.mod +++ b/vendor.mod @@ -12,7 +12,7 @@ require ( github.com/creack/pty v1.1.21 github.com/distribution/reference v0.5.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v25.0.1+incompatible + github.com/docker/docker v25.0.1-0.20240124114027-43ffb1ee9d5a+incompatible github.com/docker/docker-credential-helpers v0.8.1 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 733b5599c3..e644e203df 100644 --- a/vendor.sum +++ b/vendor.sum @@ -54,8 +54,8 @@ github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5 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 v25.0.1+incompatible h1:k5TYd5rIVQRSqcTwCID+cyVA0yRg86+Pcrz1ls0/frA= -github.com/docker/docker v25.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.1-0.20240124114027-43ffb1ee9d5a+incompatible h1:zxis4E1+Q2Q7DEDD41XU3ZPtdn5gmtMY3+E6NNpvGWs= +github.com/docker/docker v25.0.1-0.20240124114027-43ffb1ee9d5a+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= 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 37e553d418..866ad8f676 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 Current REST API - DefaultVersion = "1.44" + DefaultVersion = "1.45" // NoBaseImageSpecifier is the symbol used by the FROM // command to specify that no base image is to be used. diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index 567939580b..4cdffb6a38 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.44" +basePath: "/v1.45" info: title: "Docker Engine API" - version: "1.44" + version: "1.45" 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.44) is used. - For example, calling `/info` is the same as calling `/v1.44/info`. Using the + If you omit the version-prefix, the current version of the API (v1.45) is used. + For example, calling `/info` is the same as calling `/v1.45/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, @@ -423,6 +423,10 @@ definitions: type: "object" additionalProperties: type: "string" + Subpath: + description: "Source path inside the volume. Must be relative without any back traversals." + type: "string" + example: "dir-inside-volume/subdirectory" TmpfsOptions: description: "Optional configuration for the `tmpfs` type." type: "object" diff --git a/vendor/github.com/docker/docker/api/types/client.go b/vendor/github.com/docker/docker/api/types/client.go index 24b00a2759..882201f0ea 100644 --- a/vendor/github.com/docker/docker/api/types/client.go +++ b/vendor/github.com/docker/docker/api/types/client.go @@ -157,42 +157,12 @@ type ImageBuildResponse struct { OSType string } -// ImageCreateOptions holds information to create images. -type ImageCreateOptions struct { - RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry. - Platform string // Platform is the target platform of the image if it needs to be pulled from the registry. -} - // ImageImportSource holds source information for ImageImport type ImageImportSource struct { Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this. SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute. } -// ImageImportOptions holds information to import images from the client host. -type ImageImportOptions struct { - Tag string // Tag is the name to tag this image with. This attribute is deprecated. - Message string // Message is the message to tag the image with - Changes []string // Changes are the raw changes to apply to this image - Platform string // Platform is the target platform of the image -} - -// ImageListOptions holds parameters to list images with. -type ImageListOptions struct { - // All controls whether all images in the graph are filtered, or just - // the heads. - All bool - - // Filters is a JSON-encoded set of filter arguments. - Filters filters.Args - - // SharedSize indicates whether the shared size of images should be computed. - SharedSize bool - - // ContainerCount indicates whether container count should be computed. - ContainerCount bool -} - // ImageLoadResponse returns information to the client about a load process. type ImageLoadResponse struct { // Body must be closed to avoid a resource leak @@ -200,14 +170,6 @@ type ImageLoadResponse struct { JSON bool } -// ImagePullOptions holds information to pull images. -type ImagePullOptions struct { - All bool - RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry - PrivilegeFunc RequestPrivilegeFunc - Platform string -} - // RequestPrivilegeFunc is a function interface that // clients can supply to retry operations after // getting an authorization error. @@ -216,15 +178,6 @@ type ImagePullOptions struct { // if the privilege request fails. type RequestPrivilegeFunc func() (string, error) -// ImagePushOptions holds information to push images. -type ImagePushOptions ImagePullOptions - -// ImageRemoveOptions holds parameters to remove images. -type ImageRemoveOptions struct { - Force bool - PruneChildren bool -} - // ImageSearchOptions holds parameters to search images with. type ImageSearchOptions struct { RegistryAuth string diff --git a/vendor/github.com/docker/docker/api/types/image/opts.go b/vendor/github.com/docker/docker/api/types/image/opts.go index 3cefecb0da..c6b1f351b4 100644 --- a/vendor/github.com/docker/docker/api/types/image/opts.go +++ b/vendor/github.com/docker/docker/api/types/image/opts.go @@ -1,9 +1,57 @@ package image -import ocispec "github.com/opencontainers/image-spec/specs-go/v1" +import "github.com/docker/docker/api/types/filters" -// GetImageOpts holds parameters to inspect an image. -type GetImageOpts struct { - Platform *ocispec.Platform - Details bool +// ImportOptions holds information to import images from the client host. +type ImportOptions struct { + Tag string // Tag is the name to tag this image with. This attribute is deprecated. + Message string // Message is the message to tag the image with + Changes []string // Changes are the raw changes to apply to this image + Platform string // Platform is the target platform of the image +} + +// CreateOptions holds information to create images. +type CreateOptions struct { + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry. + Platform string // Platform is the target platform of the image if it needs to be pulled from the registry. +} + +// PullOptions holds information to pull images. +type PullOptions struct { + All bool + RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry + + // PrivilegeFunc is a function that clients can supply to retry operations + // after getting an authorization error. This function returns the registry + // authentication header value in base64 encoded format, or an error if the + // privilege request fails. + // + // Also see [github.com/docker/docker/api/types.RequestPrivilegeFunc]. + PrivilegeFunc func() (string, error) + Platform string +} + +// PushOptions holds information to push images. +type PushOptions PullOptions + +// ListOptions holds parameters to list images with. +type ListOptions struct { + // All controls whether all images in the graph are filtered, or just + // the heads. + All bool + + // Filters is a JSON-encoded set of filter arguments. + Filters filters.Args + + // SharedSize indicates whether the shared size of images should be computed. + SharedSize bool + + // ContainerCount indicates whether container count should be computed. + ContainerCount bool +} + +// RemoveOptions holds parameters to remove images. +type RemoveOptions struct { + Force bool + PruneChildren bool } diff --git a/vendor/github.com/docker/docker/api/types/mount/mount.go b/vendor/github.com/docker/docker/api/types/mount/mount.go index 57edf2ef18..6fe04da257 100644 --- a/vendor/github.com/docker/docker/api/types/mount/mount.go +++ b/vendor/github.com/docker/docker/api/types/mount/mount.go @@ -96,6 +96,7 @@ type BindOptions struct { type VolumeOptions struct { NoCopy bool `json:",omitempty"` Labels map[string]string `json:",omitempty"` + Subpath string `json:",omitempty"` DriverConfig *Driver `json:",omitempty"` } 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 e332a7bb6d..231a5cca46 100644 --- a/vendor/github.com/docker/docker/api/types/types_deprecated.go +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -1,138 +1,35 @@ package types import ( - "github.com/docker/docker/api/types/checkpoint" - "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" - "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/api/types/system" ) -// CheckpointCreateOptions holds parameters to create a checkpoint from a container. +// ImageImportOptions holds information to import images from the client host. // -// Deprecated: use [checkpoint.CreateOptions]. -type CheckpointCreateOptions = checkpoint.CreateOptions +// Deprecated: use [image.ImportOptions]. +type ImageImportOptions = image.ImportOptions -// CheckpointListOptions holds parameters to list checkpoints for a container +// ImageCreateOptions holds information to create images. // -// Deprecated: use [checkpoint.ListOptions]. -type CheckpointListOptions = checkpoint.ListOptions +// Deprecated: use [image.CreateOptions]. +type ImageCreateOptions = image.CreateOptions -// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container +// ImagePullOptions holds information to pull images. // -// Deprecated: use [checkpoint.DeleteOptions]. -type CheckpointDeleteOptions = checkpoint.DeleteOptions +// Deprecated: use [image.PullOptions]. +type ImagePullOptions = image.PullOptions -// Checkpoint represents the details of a checkpoint when listing endpoints. +// ImagePushOptions holds information to push images. // -// Deprecated: use [checkpoint.Summary]. -type Checkpoint = checkpoint.Summary +// Deprecated: use [image.PushOptions]. +type ImagePushOptions = image.PushOptions -// Info contains response of Engine API: -// GET "/info" +// ImageListOptions holds parameters to list images with. // -// Deprecated: use [system.Info]. -type Info = system.Info +// Deprecated: use [image.ListOptions]. +type ImageListOptions = image.ListOptions -// Commit holds the Git-commit (SHA1) that a binary was built from, as reported -// in the version-string of external tools, such as containerd, or runC. +// ImageRemoveOptions holds parameters to remove images. // -// Deprecated: use [system.Commit]. -type Commit = system.Commit - -// PluginsInfo is a temp struct holding Plugins name -// registered with docker daemon. It is used by [system.Info] struct -// -// Deprecated: use [system.PluginsInfo]. -type PluginsInfo = system.PluginsInfo - -// NetworkAddressPool is a temp struct used by [system.Info] struct. -// -// Deprecated: use [system.NetworkAddressPool]. -type NetworkAddressPool = system.NetworkAddressPool - -// Runtime describes an OCI runtime. -// -// Deprecated: use [system.Runtime]. -type Runtime = system.Runtime - -// SecurityOpt contains the name and options of a security option. -// -// Deprecated: use [system.SecurityOpt]. -type SecurityOpt = system.SecurityOpt - -// KeyValue holds a key/value pair. -// -// Deprecated: use [system.KeyValue]. -type KeyValue = system.KeyValue - -// ImageDeleteResponseItem image delete response item. -// -// Deprecated: use [image.DeleteResponse]. -type ImageDeleteResponseItem = image.DeleteResponse - -// ImageSummary image summary. -// -// Deprecated: use [image.Summary]. -type ImageSummary = image.Summary - -// ImageMetadata contains engine-local data about the image. -// -// Deprecated: use [image.Metadata]. -type ImageMetadata = image.Metadata - -// ServiceCreateResponse contains the information returned to a client -// on the creation of a new service. -// -// Deprecated: use [swarm.ServiceCreateResponse]. -type ServiceCreateResponse = swarm.ServiceCreateResponse - -// ServiceUpdateResponse service update response. -// -// Deprecated: use [swarm.ServiceUpdateResponse]. -type ServiceUpdateResponse = swarm.ServiceUpdateResponse - -// ContainerStartOptions holds parameters to start containers. -// -// Deprecated: use [container.StartOptions]. -type ContainerStartOptions = container.StartOptions - -// ResizeOptions holds parameters to resize a TTY. -// It can be used to resize container TTYs and -// exec process TTYs too. -// -// Deprecated: use [container.ResizeOptions]. -type ResizeOptions = container.ResizeOptions - -// ContainerAttachOptions holds parameters to attach to a container. -// -// Deprecated: use [container.AttachOptions]. -type ContainerAttachOptions = container.AttachOptions - -// ContainerCommitOptions holds parameters to commit changes into a container. -// -// Deprecated: use [container.CommitOptions]. -type ContainerCommitOptions = container.CommitOptions - -// ContainerListOptions holds parameters to list containers with. -// -// Deprecated: use [container.ListOptions]. -type ContainerListOptions = container.ListOptions - -// ContainerLogsOptions holds parameters to filter logs with. -// -// Deprecated: use [container.LogsOptions]. -type ContainerLogsOptions = container.LogsOptions - -// ContainerRemoveOptions holds parameters to remove containers. -// -// Deprecated: use [container.RemoveOptions]. -type ContainerRemoveOptions = container.RemoveOptions - -// DecodeSecurityOptions decodes a security options string slice to a type safe -// [system.SecurityOpt]. -// -// Deprecated: use [system.DecodeSecurityOptions]. -func DecodeSecurityOptions(opts []string) ([]system.SecurityOpt, error) { - return system.DecodeSecurityOptions(opts) -} +// Deprecated: use [image.RemoveOptions]. +type ImageRemoveOptions = image.RemoveOptions diff --git a/vendor/github.com/docker/docker/client/distribution_inspect.go b/vendor/github.com/docker/docker/client/distribution_inspect.go index 68ef31b78b..68e6ec5ed6 100644 --- a/vendor/github.com/docker/docker/client/distribution_inspect.go +++ b/vendor/github.com/docker/docker/client/distribution_inspect.go @@ -10,11 +10,11 @@ import ( ) // DistributionInspect returns the image digest with the full manifest. -func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registry.DistributionInspect, error) { +func (cli *Client) DistributionInspect(ctx context.Context, imageRef, encodedRegistryAuth string) (registry.DistributionInspect, error) { // Contact the registry to retrieve digest and platform information var distributionInspect registry.DistributionInspect - if image == "" { - return distributionInspect, objectNotFoundError{object: "distribution", id: image} + if imageRef == "" { + return distributionInspect, objectNotFoundError{object: "distribution", id: imageRef} } if err := cli.NewVersionError(ctx, "1.30", "distribution inspect"); err != nil { @@ -28,7 +28,7 @@ func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegist } } - resp, err := cli.get(ctx, "/distribution/"+image+"/json", url.Values{}, headers) + resp, err := cli.get(ctx, "/distribution/"+imageRef+"/json", url.Values{}, headers) defer ensureReaderClosed(resp) if err != nil { return distributionInspect, err diff --git a/vendor/github.com/docker/docker/client/image_create.go b/vendor/github.com/docker/docker/client/image_create.go index 29cd0b4373..7c7873dca5 100644 --- a/vendor/github.com/docker/docker/client/image_create.go +++ b/vendor/github.com/docker/docker/client/image_create.go @@ -8,13 +8,13 @@ import ( "strings" "github.com/distribution/reference" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/registry" ) // ImageCreate creates a new image based on the parent options. // It returns the JSON content in the response body. -func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { +func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) { ref, err := reference.ParseNormalizedNamed(parentReference) if err != nil { return nil, err diff --git a/vendor/github.com/docker/docker/client/image_import.go b/vendor/github.com/docker/docker/client/image_import.go index cd376a14e5..5a890b0c59 100644 --- a/vendor/github.com/docker/docker/client/image_import.go +++ b/vendor/github.com/docker/docker/client/image_import.go @@ -8,11 +8,12 @@ import ( "github.com/distribution/reference" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" ) // ImageImport creates a new image based on the source options. // It returns the JSON content in the response body. -func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { +func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { if ref != "" { // Check if the given image name can be resolved if _, err := reference.ParseNormalizedNamed(ref); err != nil { diff --git a/vendor/github.com/docker/docker/client/image_list.go b/vendor/github.com/docker/docker/client/image_list.go index f3f2280e32..b4df6ff86a 100644 --- a/vendor/github.com/docker/docker/client/image_list.go +++ b/vendor/github.com/docker/docker/client/image_list.go @@ -5,14 +5,13 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/versions" ) // ImageList returns a list of images in the docker host. -func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) { +func (cli *Client) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error) { // Make sure we negotiated (if the client is configured to do so), // as code below contains API-version specific handling of options. // diff --git a/vendor/github.com/docker/docker/client/image_pull.go b/vendor/github.com/docker/docker/client/image_pull.go index d92049d588..6438cf6a96 100644 --- a/vendor/github.com/docker/docker/client/image_pull.go +++ b/vendor/github.com/docker/docker/client/image_pull.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/distribution/reference" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/errdefs" ) @@ -19,7 +19,7 @@ import ( // FIXME(vdemeester): there is currently used in a few way in docker/docker // - if not in trusted content, ref is used to pass the whole reference, and tag is empty // - if in trusted content, ref is used to pass the reference name, and tag for the digest -func (cli *Client) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) { +func (cli *Client) ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error) { ref, err := reference.ParseNormalizedNamed(refStr) if err != nil { return nil, err diff --git a/vendor/github.com/docker/docker/client/image_push.go b/vendor/github.com/docker/docker/client/image_push.go index 6839a89e07..e6a6b11eea 100644 --- a/vendor/github.com/docker/docker/client/image_push.go +++ b/vendor/github.com/docker/docker/client/image_push.go @@ -8,7 +8,7 @@ import ( "net/url" "github.com/distribution/reference" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/errdefs" ) @@ -17,7 +17,7 @@ import ( // It executes the privileged function if the operation is unauthorized // and it tries one more time. // It's up to the caller to handle the io.ReadCloser and close it properly. -func (cli *Client) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error) { +func (cli *Client) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) { ref, err := reference.ParseNormalizedNamed(image) if err != nil { return nil, err diff --git a/vendor/github.com/docker/docker/client/image_remove.go b/vendor/github.com/docker/docker/client/image_remove.go index b936d20830..652d1bfa3e 100644 --- a/vendor/github.com/docker/docker/client/image_remove.go +++ b/vendor/github.com/docker/docker/client/image_remove.go @@ -5,12 +5,11 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" ) // ImageRemove removes an image from the docker host. -func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { +func (cli *Client) ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error) { query := url.Values{} if options.Force { diff --git a/vendor/github.com/docker/docker/client/interface.go b/vendor/github.com/docker/docker/client/interface.go index 302f5fb13e..45d233f253 100644 --- a/vendor/github.com/docker/docker/client/interface.go +++ b/vendor/github.com/docker/docker/client/interface.go @@ -90,15 +90,15 @@ 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) BuildCancel(ctx context.Context, id string) error - ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) + ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error) - ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) - ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) + ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) - ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) - ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) - ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) + ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error) + ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error) + ImageRemove(ctx context.Context, image string, options image.RemoveOptions) ([]image.DeleteResponse, error) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) ImageTag(ctx context.Context, image, ref string) error diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir.go b/vendor/github.com/docker/docker/pkg/homedir/homedir.go index 590683206c..c0ab3f5bf3 100644 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir.go +++ b/vendor/github.com/docker/docker/pkg/homedir/homedir.go @@ -6,14 +6,6 @@ import ( "runtime" ) -// Key returns the env var name for the user's home dir based on -// the platform being run on. -// -// Deprecated: this function is no longer used, and will be removed in the next release. -func Key() string { - return envKeyName -} - // Get returns the home directory of the current user with the help of // environment variables depending on the target operating system. // Returned path should be used with "path/filepath" to form new paths. @@ -34,11 +26,3 @@ func Get() string { } return home } - -// GetShortcutString returns the string that is shortcut to user's home directory -// in the native shell of the platform running on. -// -// Deprecated: this function is no longer used, and will be removed in the next release. -func GetShortcutString() string { - return homeShortCut -} diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go deleted file mode 100644 index feae4d736c..0000000000 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build !windows - -package homedir // import "github.com/docker/docker/pkg/homedir" - -const ( - envKeyName = "HOME" - homeShortCut = "~" -) diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go deleted file mode 100644 index 37f4ee6701..0000000000 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go +++ /dev/null @@ -1,6 +0,0 @@ -package homedir // import "github.com/docker/docker/pkg/homedir" - -const ( - envKeyName = "USERPROFILE" - homeShortCut = "%USERPROFILE%" // be careful while using in format functions -) diff --git a/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go b/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go deleted file mode 100644 index afb57dae6a..0000000000 --- a/vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go +++ /dev/null @@ -1,19 +0,0 @@ -package system - -import ( - "errors" - "runtime" - "strings" -) - -// ErrNotSupportedOperatingSystem means the operating system is not supported. -// -// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned. -var ErrNotSupportedOperatingSystem = errors.New("operating system is not supported") - -// IsOSSupported determines if an operating system is supported by the host. -// -// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned. -func IsOSSupported(os string) bool { - return strings.EqualFold(runtime.GOOS, os) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 14530e45c7..9fe3498015 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -53,7 +53,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 v25.0.1+incompatible +# github.com/docker/docker v25.0.1-0.20240124114027-43ffb1ee9d5a+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types From 4fa2fe9b9e1c0fc5e1de49ea3ba65ee0f823c0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 24 Jan 2024 14:32:07 +0100 Subject: [PATCH 2/2] Replace deprecated types.Image* usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Gronowski --- cli/command/completion/functions.go | 3 ++- cli/command/container/client_test.go | 5 +++-- cli/command/container/create.go | 4 ++-- cli/command/container/create_test.go | 4 ++-- cli/command/image/client_test.go | 20 ++++++++++---------- cli/command/image/import.go | 3 ++- cli/command/image/import_test.go | 15 ++++++++------- cli/command/image/list.go | 4 ++-- cli/command/image/list_test.go | 11 +++++------ cli/command/image/pull_test.go | 6 +++--- cli/command/image/push.go | 4 ++-- cli/command/image/push_test.go | 8 ++++---- cli/command/image/remove.go | 4 ++-- cli/command/image/remove_test.go | 17 ++++++++--------- cli/command/image/trust.go | 5 +++-- cli/command/trust/inspect_pretty_test.go | 3 ++- cli/command/trust/sign.go | 4 ++-- 17 files changed, 62 insertions(+), 58 deletions(-) diff --git a/cli/command/completion/functions.go b/cli/command/completion/functions.go index 7a53ede243..ae79f811fe 100644 --- a/cli/command/completion/functions.go +++ b/cli/command/completion/functions.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/cli/command/formatter" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/volume" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ type ValidArgsFn func(cmd *cobra.Command, args []string, toComplete string) ([]s // ImageNames offers completion for images present within the local store func ImageNames(dockerCli command.Cli) ValidArgsFn { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - list, err := dockerCli.Client().ImageList(cmd.Context(), types.ImageListOptions{}) + list, err := dockerCli.Client().ImageList(cmd.Context(), image.ListOptions{}) if err != nil { return nil, cobra.ShellCompDirectiveError } diff --git a/cli/command/container/client_test.go b/cli/command/container/client_test.go index 68f56c70b5..4b17fb3ca9 100644 --- a/cli/command/container/client_test.go +++ b/cli/command/container/client_test.go @@ -6,6 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/docker/docker/client" @@ -23,7 +24,7 @@ type fakeClient struct { platform *specs.Platform, containerName string) (container.CreateResponse, error) containerStartFunc func(containerID string, options container.StartOptions) error - imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) + imageCreateFunc func(parentReference string, options image.CreateOptions) (io.ReadCloser, error) infoFunc func() (system.Info, error) containerStatPathFunc func(containerID, path string) (types.ContainerPathStat, error) containerCopyFromFunc func(containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) @@ -90,7 +91,7 @@ func (f *fakeClient) ContainerRemove(ctx context.Context, containerID string, op return nil } -func (f *fakeClient) ImageCreate(_ context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { +func (f *fakeClient) ImageCreate(_ context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) { if f.imageCreateFunc != nil { return f.imageCreateFunc(parentReference, options) } diff --git a/cli/command/container/create.go b/cli/command/container/create.go index beaad77fd0..70bf509c4e 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -15,8 +15,8 @@ import ( "github.com/docker/cli/cli/command/image" "github.com/docker/cli/cli/streams" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + imagetypes "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/errdefs" "github.com/docker/docker/pkg/jsonmessage" @@ -119,7 +119,7 @@ func pullImage(ctx context.Context, dockerCli command.Cli, img string, options * return err } - responseBody, err := dockerCli.Client().ImageCreate(ctx, img, types.ImageCreateOptions{ + responseBody, err := dockerCli.Client().ImageCreate(ctx, img, imagetypes.CreateOptions{ RegistryAuth: encodedAuth, Platform: options.platform, }) diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index 546da0d095..36158dd3be 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/google/go-cmp/cmp" @@ -134,7 +134,7 @@ func TestCreateContainerImagePullPolicy(t *testing.T) { return container.CreateResponse{ID: containerID}, nil } }, - imageCreateFunc: func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { + imageCreateFunc: func(parentReference string, options image.CreateOptions) (io.ReadCloser, error) { defer func() { pullCounter++ }() return io.NopCloser(strings.NewReader("")), nil }, diff --git a/cli/command/image/client_test.go b/cli/command/image/client_test.go index 5c5bf985a4..3700b53930 100644 --- a/cli/command/image/client_test.go +++ b/cli/command/image/client_test.go @@ -17,15 +17,15 @@ type fakeClient struct { client.Client imageTagFunc func(string, string) error imageSaveFunc func(images []string) (io.ReadCloser, error) - imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) - imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) + imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error) + imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error) infoFunc func() (system.Info, error) - imagePullFunc func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) + imagePullFunc func(ref string, options image.PullOptions) (io.ReadCloser, error) imagesPruneFunc func(pruneFilter filters.Args) (types.ImagesPruneReport, error) imageLoadFunc func(input io.Reader, quiet bool) (types.ImageLoadResponse, error) - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) imageInspectFunc func(image string) (types.ImageInspect, []byte, error) - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) imageHistoryFunc func(image string) ([]image.HistoryResponseItem, error) imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error) } @@ -45,7 +45,7 @@ func (cli *fakeClient) ImageSave(_ context.Context, images []string) (io.ReadClo } func (cli *fakeClient) ImageRemove(_ context.Context, img string, - options types.ImageRemoveOptions, + options image.RemoveOptions, ) ([]image.DeleteResponse, error) { if cli.imageRemoveFunc != nil { return cli.imageRemoveFunc(img, options) @@ -53,7 +53,7 @@ func (cli *fakeClient) ImageRemove(_ context.Context, img string, return []image.DeleteResponse{}, nil } -func (cli *fakeClient) ImagePush(_ context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) { +func (cli *fakeClient) ImagePush(_ context.Context, ref string, options image.PushOptions) (io.ReadCloser, error) { if cli.imagePushFunc != nil { return cli.imagePushFunc(ref, options) } @@ -67,7 +67,7 @@ func (cli *fakeClient) Info(_ context.Context) (system.Info, error) { return system.Info{}, nil } -func (cli *fakeClient) ImagePull(_ context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) { +func (cli *fakeClient) ImagePull(_ context.Context, ref string, options image.PullOptions) (io.ReadCloser, error) { if cli.imagePullFunc != nil { cli.imagePullFunc(ref, options) } @@ -88,7 +88,7 @@ func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, quiet bool) return types.ImageLoadResponse{}, nil } -func (cli *fakeClient) ImageList(_ context.Context, options types.ImageListOptions) ([]image.Summary, error) { +func (cli *fakeClient) ImageList(_ context.Context, options image.ListOptions) ([]image.Summary, error) { if cli.imageListFunc != nil { return cli.imageListFunc(options) } @@ -103,7 +103,7 @@ func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, img string) (types } func (cli *fakeClient) ImageImport(_ context.Context, source types.ImageImportSource, ref string, - options types.ImageImportOptions, + options image.ImportOptions, ) (io.ReadCloser, error) { if cli.imageImportFunc != nil { return cli.imageImportFunc(source, ref, options) diff --git a/cli/command/image/import.go b/cli/command/image/import.go index f7a0af8832..d3bf698300 100644 --- a/cli/command/image/import.go +++ b/cli/command/image/import.go @@ -9,6 +9,7 @@ import ( "github.com/docker/cli/cli/command" dockeropts "github.com/docker/cli/opts" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/pkg/jsonmessage" "github.com/spf13/cobra" ) @@ -78,7 +79,7 @@ func runImport(ctx context.Context, dockerCli command.Cli, options importOptions } } - responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, types.ImageImportOptions{ + responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, image.ImportOptions{ Message: options.message, Changes: options.changes.GetAll(), Platform: options.platform, diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 4196f4fbbe..6531e2ca35 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -17,7 +18,7 @@ func TestNewImportCommandErrors(t *testing.T) { name string args []string expectedError string - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) }{ { name: "wrong-args", @@ -28,7 +29,7 @@ func TestNewImportCommandErrors(t *testing.T) { name: "import-failed", args: []string{"testdata/import-command-success.input.txt"}, expectedError: "something went wrong", - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { return nil, errors.Errorf("something went wrong") }, }, @@ -52,7 +53,7 @@ func TestNewImportCommandSuccess(t *testing.T) { testCases := []struct { name string args []string - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) }{ { name: "simple", @@ -65,7 +66,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "double", args: []string{"-", "image:local"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("image:local", ref)) return io.NopCloser(strings.NewReader("")), nil }, @@ -73,7 +74,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "message", args: []string{"--message", "test message", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("test message", options.Message)) return io.NopCloser(strings.NewReader("")), nil }, @@ -81,7 +82,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "change", args: []string{"--change", "ENV DEBUG=true", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("ENV DEBUG=true", options.Changes[0])) return io.NopCloser(strings.NewReader("")), nil }, @@ -89,7 +90,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "change legacy syntax", args: []string{"--change", "ENV DEBUG true", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("ENV DEBUG true", options.Changes[0])) return io.NopCloser(strings.NewReader("")), nil }, diff --git a/cli/command/image/list.go b/cli/command/image/list.go index 81ce4d914b..887ca9c9a4 100644 --- a/cli/command/image/list.go +++ b/cli/command/image/list.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/spf13/cobra" ) @@ -68,7 +68,7 @@ func runImages(ctx context.Context, dockerCli command.Cli, options imagesOptions filters.Add("reference", options.matchName) } - listOptions := types.ImageListOptions{ + listOptions := image.ListOptions{ All: options.all, Filters: filters, } diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index 11c8b47943..d8b583d8d4 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" @@ -20,7 +19,7 @@ func TestNewImagesCommandErrors(t *testing.T) { name string args []string expectedError string - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) }{ { name: "wrong-args", @@ -30,7 +29,7 @@ func TestNewImagesCommandErrors(t *testing.T) { { name: "failed-list", expectedError: "something went wrong", - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { return []image.Summary{}, errors.Errorf("something went wrong") }, }, @@ -48,7 +47,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { name string args []string imageFormat string - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) }{ { name: "simple", @@ -65,7 +64,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { { name: "match-name", args: []string{"image"}, - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0])) return []image.Summary{}, nil }, @@ -73,7 +72,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { { name: "filters", args: []string{"--filter", "name=value"}, - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { assert.Check(t, is.Equal("value", options.Filters.Get("name")[0])) return []image.Summary{}, nil }, diff --git a/cli/command/image/pull_test.go b/cli/command/image/pull_test.go index 8d197b9f95..51e8ece6e6 100644 --- a/cli/command/image/pull_test.go +++ b/cli/command/image/pull_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" "gotest.tools/v3/golden" @@ -69,7 +69,7 @@ func TestNewPullCommandSuccess(t *testing.T) { } for _, tc := range testCases { cli := test.NewFakeCli(&fakeClient{ - imagePullFunc: func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) { + imagePullFunc: func(ref string, options image.PullOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal(tc.expectedTag, ref), tc.name) return io.NopCloser(strings.NewReader("")), nil }, @@ -111,7 +111,7 @@ func TestNewPullCommandWithContentTrustErrors(t *testing.T) { } for _, tc := range testCases { cli := test.NewFakeCli(&fakeClient{ - imagePullFunc: func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) { + imagePullFunc: func(ref string, options image.PullOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), fmt.Errorf("shouldn't try to pull image") }, }, test.EnableContentTrust) diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 98b9f24da7..18b4e9ecbb 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -10,7 +10,7 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/streams" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/registry" @@ -80,7 +80,7 @@ func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error return err } requestPrivilege := command.RegistryAuthenticationPrivilegedFunc(dockerCli, repoInfo.Index, "push") - options := types.ImagePushOptions{ + options := image.PushOptions{ All: opts.all, RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index bcff265a79..6ba7235775 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" ) @@ -16,7 +16,7 @@ func TestNewPushCommandErrors(t *testing.T) { name string args []string expectedError string - imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) + imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error) }{ { name: "wrong-args", @@ -32,7 +32,7 @@ func TestNewPushCommandErrors(t *testing.T) { name: "push-failed", args: []string{"image:repo"}, expectedError: "Failed to push", - imagePushFunc: func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) { + imagePushFunc: func(ref string, options image.PushOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), errors.Errorf("Failed to push") }, }, @@ -67,7 +67,7 @@ func TestNewPushCommandSuccess(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - imagePushFunc: func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) { + imagePushFunc: func(ref string, options image.PushOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), nil }, }) diff --git a/cli/command/image/remove.go b/cli/command/image/remove.go index 4f18c41cb0..e0983f377f 100644 --- a/cli/command/image/remove.go +++ b/cli/command/image/remove.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/errdefs" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -52,7 +52,7 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command { func runRemove(ctx context.Context, dockerCli command.Cli, opts removeOptions, images []string) error { client := dockerCli.Client() - options := types.ImageRemoveOptions{ + options := image.RemoveOptions{ Force: opts.force, PruneChildren: !opts.noPrune, } diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index 566053b49d..9220a5a16b 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" @@ -36,7 +35,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name string args []string expectedError string - imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) + imageRemoveFunc func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) }{ { name: "wrong args", @@ -46,7 +45,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name: "ImageRemove fail with force option", args: []string{"-f", "image1"}, expectedError: "error removing image", - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{}, errors.Errorf("error removing image") }, @@ -55,7 +54,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name: "ImageRemove fail", args: []string{"arg1"}, expectedError: "error removing image", - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, !options.Force) assert.Check(t, options.PruneChildren) return []image.DeleteResponse{}, errors.Errorf("error removing image") @@ -78,13 +77,13 @@ func TestNewRemoveCommandSuccess(t *testing.T) { testCases := []struct { name string args []string - imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) + imageRemoveFunc func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) expectedStderr string }{ { name: "Image Deleted", args: []string{"image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{{Deleted: img}}, nil }, @@ -92,7 +91,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image not found with force option", args: []string{"-f", "image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) assert.Check(t, is.Equal(true, options.Force)) return []image.DeleteResponse{}, notFound{"image1"} @@ -103,7 +102,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image Untagged", args: []string{"image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{{Untagged: img}}, nil }, @@ -111,7 +110,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image Deleted and Untagged", args: []string{"image1", "image2"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { if img == "image1" { return []image.DeleteResponse{{Untagged: img}}, nil } diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index 675da83fd6..59601a2544 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -13,6 +13,7 @@ import ( "github.com/docker/cli/cli/streams" "github.com/docker/cli/cli/trust" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/registry" @@ -30,7 +31,7 @@ type target struct { } // TrustedPush handles content trust pushing of an image -func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options types.ImagePushOptions) error { +func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options image.PushOptions) error { responseBody, err := cli.Client().ImagePush(ctx, reference.FamiliarString(ref), options) if err != nil { return err @@ -267,7 +268,7 @@ func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth tru return err } requestPrivilege := command.RegistryAuthenticationPrivilegedFunc(cli, imgRefAndAuth.RepoInfo().Index, "pull") - responseBody, err := cli.Client().ImagePull(ctx, reference.FamiliarString(imgRefAndAuth.Reference()), types.ImagePullOptions{ + responseBody, err := cli.Client().ImagePull(ctx, reference.FamiliarString(imgRefAndAuth.Reference()), image.PullOptions{ RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, All: opts.all, diff --git a/cli/command/trust/inspect_pretty_test.go b/cli/command/trust/inspect_pretty_test.go index 196bbd7e62..4ae00725e9 100644 --- a/cli/command/trust/inspect_pretty_test.go +++ b/cli/command/trust/inspect_pretty_test.go @@ -11,6 +11,7 @@ import ( "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/system" apiclient "github.com/docker/docker/client" "github.com/theupdateframework/notary" @@ -36,7 +37,7 @@ func (c *fakeClient) ImageInspectWithRaw(context.Context, string) (types.ImageIn return types.ImageInspect{}, []byte{}, nil } -func (c *fakeClient) ImagePush(context.Context, string, types.ImagePushOptions) (io.ReadCloser, error) { +func (c *fakeClient) ImagePush(context.Context, string, image.PushOptions) (io.ReadCloser, error) { return &utils.NoopCloser{Reader: bytes.NewBuffer([]byte{})}, nil } diff --git a/cli/command/trust/sign.go b/cli/command/trust/sign.go index 72cfc2d103..54da63643f 100644 --- a/cli/command/trust/sign.go +++ b/cli/command/trust/sign.go @@ -12,7 +12,7 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/image" "github.com/docker/cli/cli/trust" - "github.com/docker/docker/api/types" + imagetypes "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" apiclient "github.com/docker/docker/client" "github.com/pkg/errors" @@ -98,7 +98,7 @@ func runSignImage(ctx context.Context, dockerCLI command.Cli, options signOption if err != nil { return err } - options := types.ImagePushOptions{ + options := imagetypes.PushOptions{ RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, }