Commit Graph

54662 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
ddbb503dc7 client: change Raw fields to be json.RawMessage
These fields store the raw JSON data that we received, and should
never container bytes that are non-JSON (as we'd error out when
failing to unmarshal).

Change the type to a json.RawMessage, which:

- Is more explicit on intent
- Can still be used as a regular []byte in all cases

And, while it's not expected to be marshaled to JSON, doing so will also
print the output in a readable format instead of base64 encoding;

    package main

    import (
        "encoding/json"
        "fmt"
    )

    func main() {
        foo := struct {
            Bytes []byte
            Raw   json.RawMessage
        }{
            Bytes: []byte(`{"hello": "world"}`),
            Raw:   json.RawMessage(`{"hello": "world"}`),
        }

        out, _ := json.MarshalIndent(foo, "", "  ")
        fmt.Println(string(out))
    }

Will print:

    {
      "Bytes": "eyJoZWxsbyI6ICJ3b3JsZCJ9",
      "Raw": {
        "hello": "world"
      }
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 19:07:26 +02:00
Sebastiaan van Stijn
2bda4a2001 Merge pull request #51285 from thaJeztah/client_fixes
client: assorted fixes and refactor
2025-10-24 18:44:10 +02:00
Sebastiaan van Stijn
12123eb592 client: merge ExecInspectResult with ExecInspect
The `ExecInspectResult` type was embedding `ExecInspect`, which is also
defined by the client, so there's no need to abstract it.

While updating, also;

- Rename `ExecID` to `ID`, to match the field-name returned by the API.
- Rename `Pid` to `PID`, to be in the right casing.
- Remove `json` labels, as option-types are not (un)marshaled to JSON.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:36 +02:00
Sebastiaan van Stijn
378116a84f client: ImageImportResult: prevent panic on nil reader
This panicked when creating a stub; we need to look for better ways to
allow stubbing these (perhaps we need to expose the rc / body)?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:36 +02:00
Sebastiaan van Stijn
0b7b7625c6 client: rename NodeUpdateOptions.Node to NodeUpdateOptions.Spec
Align with the other swarm-types, which use `Spec` for updates.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +02:00
Sebastiaan van Stijn
875c577711 client: consolidate node options with their methods
Move them together, as we did for most of the other options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +02:00
Sebastiaan van Stijn
832590155c client: ExecCreateResult: define local type with ID field
The `ExecCreateResult` was embedding the `container.ExecCreateRespons`,
which in itself was an alias for `common.IDResponse`. This type has a
single field (`ID`) currently, but the embedding made it awkward to use,
for example, when mocking a `ExecCreateResult` using struct-literals:

    func execCreateWithID(_ string, _ client.ExecCreateOptions) (client.ExecCreateResult, error) {
        return client.ExecCreateResult{ExecCreateResponse: container.ExecCreateResponse{ID: "execid"}}, nil
    }

This patch defines it as a local type with the `ID` as field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:35 +02:00
Sebastiaan van Stijn
c6a45784f9 client: VolumeListResult: define local type
The `VolumeListResult.Items` field was a `volume.ListResponse`, which
in itself also had two slices (for volumes, and warnings). The Volumes
field contained a slice of pointers to Volumes.

This patch:

- Re-defines `ImageRemoveResult` as a distinct type, containing the
  content of the `volume.ListResponse.Volumes` and `.Warnings`.
- The `VolumeListResult` doesn't use a pointer for the volumes to make
  it slightly easier to deal with (possibly the API type could be
  changed as well, which could allow us to simplify the client code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 15:05:30 +02:00
Sebastiaan van Stijn
c246639baa client: rename ImageRemoveResult.Deleted to ImageRemoveResult.Items
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 14:07:10 +02:00
Sebastiaan van Stijn
8222a3f1d9 Merge pull request #51286 from thaJeztah/fix_integration
integration/service: fix tests for updated client
2025-10-24 14:06:55 +02:00
Sebastiaan van Stijn
fb85d123c1 integration/service: fix tests for updated client
These tests were added in ea59a8d74e, but it
was merged out of order, not yet picking up changes made in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 13:51:47 +02:00
Sebastiaan van Stijn
f9082484c9 Merge pull request #51278 from vvoland/client-container-opts2
client_(attach,commit,create,diff): Wrap result and options
2025-10-24 13:41:23 +02:00
Paweł Gronowski
ea59a8d74e Merge pull request #51114 from dperny/memory_flags_for_swarm
Add support for memory swap settings for services
2025-10-24 10:04:17 +02:00
Paweł Gronowski
963d9c7fee Merge pull request #51284 from austinvazquez/move-pkg-versions
api: move types/versions to client/pkg and daemon/internal
2025-10-24 09:59:22 +02:00
Austin Vazquez
f40e1a7582 api: move types/versions to client/pkg and daemon/internal
This change moves the api/types/versions package out into client and daemon versions.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 19:22:31 -05:00
Austin Vazquez
e62b820f36 Merge pull request #51282 from austinvazquez/vendor-aws-dependencies
vendor: github.com/aws/smithy-go@v1.23.1; github.com/aws/aws-sdk-go-v2@v1.39.4; github.com/aws/aws-sdk-go-v2/*
2025-10-23 17:11:39 -05:00
Austin Vazquez
d2fb85bef6 Merge pull request #51281 from austinvazquez/vendor-golang.org-x
vendor: golang.org/x/* dependencies
2025-10-23 17:11:07 -05:00
Austin Vazquez
c9b3c65f37 vendor: github.com/aws/aws-sdk-go-v2/config@v1.31.15
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:34 -05:00
Austin Vazquez
b3129817a7 vendor: github.com/aws/aws-sdk-go-v2/credentials v1.18.19
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:34 -05:00
Austin Vazquez
1b2015a26f vendor: github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.58.5
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
7f7588be22 vendor: github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
f82fa7a4b2 vendor: github.com/aws/aws-sdk-go-v2 v1.39.4
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
529076c7b4 vendor: github.com/aws/smith-go v1.23.1
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:41:33 -05:00
Austin Vazquez
031f30340b vendor: golang.org/x/net v0.46.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:27:37 -05:00
Austin Vazquez
8afa422f0c vendor: golang.org/x/time v0.14.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:26:45 -05:00
Austin Vazquez
8c88244d7f vendor: golang.org/x/text v0.30.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:26:01 -05:00
Austin Vazquez
8d3ae564e0 vendor: golang.org/x/mod v0.29.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:25:03 -05:00
Austin Vazquez
7563a498f0 vendor: golang.org/x/sys v0.37.0
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 15:24:17 -05:00
Paweł Gronowski
8fb561ca9a client/container_create: Add Image outside of Config
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Paweł Gronowski
3340c86db9 client/container_create: Rename ContainerName to Name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Paweł Gronowski
bd31b8b1c7 client_(attach,commit,create,diff): Wrap result and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Sebastiaan van Stijn
b398d92e82 Merge pull request #51277 from thaJeztah/tidy_client_utils_step2
client: simplify test with mock-responses
2025-10-23 20:45:06 +02:00
Sebastiaan van Stijn
47fd987af2 client: simplify test with mock-responses
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 17:43:10 +02:00
Sebastiaan van Stijn
1d8c8e192f Merge pull request #51279 from thaJeztah/refactor_service_update
client: refactor ServiceCreate, ServiceUpdate, SwarmUpdate
2025-10-23 17:40:33 +02:00
Sebastiaan van Stijn
3a43b5b559 client: refactor ServiceCreate, ServiceUpdate, SwarmUpdate
Put the version and spec in the options-struct, as we did for other
swarm-related methods.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 15:40:18 +02:00
Sebastiaan van Stijn
dcd668d579 Merge pull request #51276 from thaJeztah/tidy_client_utils
client: tidy-up test/mock-utilities
2025-10-23 15:40:03 +02:00
Sebastiaan van Stijn
11809618f6 Merge pull request #51270 from robmry/inspect-api-bc
Inspect: API v1.51 compatibility
2025-10-23 14:59:11 +02:00
Sebastiaan van Stijn
0fe6be8c38 client: remove roundTripFunc, bytesBufferClose
- Use the `mockResponse` instead
- `bytesBufferClose` was our own implementation of `io.NopCloser`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:54 +02:00
Sebastiaan van Stijn
b9dd7c0d59 client: tidy-up mock-utilities
- Add a `mockResponse` utility, and slightly enhance it to also include
  the request Headers and Status message, to be more closely to actual
  responses.
- Add a `mockJSONResponse` utility, implemented using `mockResponse`
- Remove `plainTextErrorMock` in favor of `mockResponse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:41 +02:00
Sebastiaan van Stijn
a315437e1c client: rename transportFunc -> testRoundTripper
Rename it so that it's clearer that it's intended for test-purposes,
and adding a `skipConfigureTransport()` method to the signature to
prevent IDEs considering is a redundant convert, and to be more explicit
on intent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-23 13:01:33 +02:00
Rob Murray
0971a3bcb8 Inspect: API v1.51 compatibility
For API < v1.52:
- In container inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Remove field Storage
  - Related to commit efa077848f
- In image inspect:
  - Restore GraphDriver when a snapshotter is used.
  - Related to commit c441b2ef19

Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-23 09:24:08 +01:00
Albin Kerouanton
37ac6cec6c Merge pull request #50114 from danegsta/50107-defaultpoolsize
Proposal: Allow specifying the subnet size for networks allocated from default pools
2025-10-23 08:53:38 +02:00
Sebastiaan van Stijn
d9c950f824 Merge pull request #51275 from thaJeztah/client_deadcode
client: remove unused hasEndpointSpecificMacAddress utility
2025-10-23 08:25:02 +02:00
Sebastiaan van Stijn
0049df8315 Merge pull request #51273 from austinvazquez/refactor-client-service-list
client: rename `ServiceListResult.Services` to `ServiceListResult.Items`
2025-10-23 00:19:30 +02:00
Sebastiaan van Stijn
f733b411a1 client: remove unused hasEndpointSpecificMacAddress utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 23:16:37 +02:00
Sebastiaan van Stijn
f2412e7ab4 Merge pull request #51262 from vvoland/client-containerexec-opts
client/container_exec: Wrap options and result
2025-10-22 23:08:50 +02:00
Austin Vazquez
5a5d39205c client: rename ServiceListResult.Services to ServiceListResult.Items
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-22 15:55:03 -05:00
Paweł Gronowski
94ab385eb5 client/container_exec: Wrap options and result, rename to Exec
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-22 22:48:59 +02:00
David Negstad
ea0d934ff2 Allow requesting networks with a custom prefix size from the default pools
Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-10-22 12:45:55 -07:00
Akihiro Suda
00abc3a9d5 Merge pull request #51266 from thaJeztah/please_linters
client: please the linters
2025-10-23 01:42:46 +09:00