Deprecate api/types/strslice.StrSlice and remove its use#50292
Deprecate api/types/strslice.StrSlice and remove its use#50292thaJeztah merged 1 commit intomoby:masterfrom
Conversation
| } | ||
| // | ||
| // Deprecated: this type was used for compatibility with deprecated API versions. Use []string instead. | ||
| type StrSlice = []string |
There was a problem hiding this comment.
Changed this to an alias for []string so that any uses of it would just become a no-op.
|
And some tests that use invalid requests (current API versions only document / support string-slice) |
| CapAdd strslice.StrSlice // List of kernel capabilities to add to the container | ||
| CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container | ||
| CapAdd []string // List of kernel capabilities to add to the container | ||
| CapDrop []string // List of kernel capabilities to remove from the container |
There was a problem hiding this comment.
Even if we do want to continue supporting the old format; these two definitely look wrong, as these fields never supported a string (instead of a slice) AFAIK.
There was a problem hiding this comment.
Looks like I was wrong there; Hmm, so CapAdd/CapDrop;
- switched to using StrSlice in 17999c7
- had some fixes related to parsing "string" instead of "slice"; 10a3061
- looks indeed like they did accept a string instead of a slice before docker 1.7; /containers/create no longer accepts a string for CapAdd or CapDrop #14318
- Which would be API v1.19 and before;
Line 20 in 10a3061
96a5500 to
8f58969
Compare
f521274 to
3cc0361
Compare
b65ffc0 to
f04c4cc
Compare
f04c4cc to
d4fb340
Compare
0eb1cf2 to
0f813a4
Compare
0f813a4 to
377f7b2
Compare
377f7b2 to
a1ecf68
Compare
|
Rebased to bring in some of the changes that have been merged to master. |
|
Definitely some weird things happening; checksum failiures in various places. Not sure if these are issues with the fixture. Also worth noting (just in case) that |
|
Error looks to come from containerd vendor; not sure why the moby/vendor/github.com/containerd/containerd/v2/client/image.go Lines 335 to 338 in 0aa8fe0 |
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal function to provide backward-compatibility with older API requests from before docker 1.7 (see [moby/moby@17d6f00] and [moby/moby@ea4a067]), which used a string instead of an array of strings for some fields (Cmd, Entrypoint). We no longer support those API versions, and we no longer support pulling v1 images that may contain such a config, so we can deprecate the type and remove its use. [moby/moby@17d6f00]: moby@17d6f00 [moby/moby@ea4a067]: moby@ea4a067 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
a1ecf68 to
9879083
Compare
|
I think this should be ready to go, but doing a quick check with the BuildKit folks. The "short" story is that;
This type is one of those poorly documented cases where we deprecated something, but (without proper versioning the API handling) just left the old in as well. Which makes sense for "post v1.0" releases, but in this case it was to bridge compatibility between early v0.x versions. |
|
Chatted with @crazy-max - and looks like BuildKit has no special handling for this; it uses the OCI types for these fields, which don't support the string format, so (famous last words) I think we should be fine. As mentioned; all handling was on unmarshalling (daemon side), so it's good to not have that implementation detail leak into the API module. I'm bringing this one in. We can probably remove the "deprecated" alias (as it's a new module), but I'm sure we have more cleanup rounds to make in the client and api modules. |
relates to;
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal function to provide backward-compatibility with older API requests from before docker 1.7 (see moby@17d6f00 and moby@ea4a067), which used a string instead of an array of strings for some fields (Cmd, Entrypoint).
We no longer support those API versions, and we no longer support pulling v1 images that may contain such a config, so we can deprecate the type and remove its use.
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)