From 5e4ddd81a2dd0eae2a18671df02f5ae7e4ab3f9b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 2 Jul 2024 01:29:36 +0200 Subject: [PATCH] api/types/system: remove Info.ExecutionDriver The execution-driver was replaced with containerd since docker 1.11 (API v1.23) in 9c4570a958df42d1ad19364b1a8da55b891d850a, after which the value was no longer set. The field was left in the type definition. Commit 1fb1136fecfd761300a38f64ac9178979cc0b270 removed its use from the CLI and [docker/engine-api@39c7d7e] removed it from the API type, followed by an update to the API docs in 3c6ef4c29d28e92ea29816d6117412162d829c60. Changes to the API types were not pulled into the engine until v1.13, and probably because of that gated it on API version < 1.25 instead of < 1.24 (see 6d98e344c7702a8a713cb9e02a19d83a79d3f930); setting a "not supported" value for older versions. Based on the above; this field was deprecated in API v1.23, and empty since then. Given that the minimum API version supported by the engine is not v1.24, we can safely remove it. [docker/engine-api@39c7d7e]: https://github.com/docker/engine-api/commit/39c7d7ec192b065f757ffdb85b36a7b3ede4e10b Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e4d792a06d7568b1136cba88749fc83041b12555) Signed-off-by: Sebastiaan van Stijn --- api/server/router/system/system_routes.go | 1 - api/types/system/info.go | 7 ------- integration/system/info_linux_test.go | 20 -------------------- 3 files changed, 28 deletions(-) diff --git a/api/server/router/system/system_routes.go b/api/server/router/system/system_routes.go index e58ef781b9..fa73169bac 100644 --- a/api/server/router/system/system_routes.go +++ b/api/server/router/system/system_routes.go @@ -81,7 +81,6 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht nameOnly = append(nameOnly, so.Name) } info.SecurityOptions = nameOnly - info.ExecutionDriver = "" //nolint:staticcheck // ignore SA1019 (ExecutionDriver is deprecated) } if versions.LessThan(version, "1.39") { if info.KernelVersion == "" { diff --git a/api/types/system/info.go b/api/types/system/info.go index 6791cf3284..c66a2afb8b 100644 --- a/api/types/system/info.go +++ b/api/types/system/info.go @@ -77,9 +77,6 @@ type Info struct { Containerd *ContainerdInfo `json:",omitempty"` - // Legacy API fields for older API versions. - legacyFields - // Warnings contains a slice of warnings that occurred while collecting // system information. These warnings are intended to be informational // messages for the user, and are not intended to be parsed / used for @@ -124,10 +121,6 @@ type ContainerdNamespaces struct { Plugins string } -type legacyFields struct { - ExecutionDriver string `json:",omitempty"` // Deprecated: deprecated since API v1.25, but returned for older versions. -} - // PluginsInfo is a temp struct holding Plugins name // registered with docker daemon. It is used by [Info] struct type PluginsInfo struct { diff --git a/integration/system/info_linux_test.go b/integration/system/info_linux_test.go index a6d8360914..f23699e35f 100644 --- a/integration/system/info_linux_test.go +++ b/integration/system/info_linux_test.go @@ -3,11 +3,8 @@ package system // import "github.com/docker/docker/integration/system" import ( - "net/http" "testing" - "github.com/docker/docker/testutil" - req "github.com/docker/docker/testutil/request" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) @@ -28,20 +25,3 @@ func TestInfoBinaryCommits(t *testing.T) { assert.Check(t, "N/A" != info.RuncCommit.ID) assert.Check(t, is.Equal(info.RuncCommit.Expected, info.RuncCommit.ID)) } - -func TestInfoAPIVersioned(t *testing.T) { - ctx := testutil.StartSpan(baseContext, t) - - res, body, err := req.Get(ctx, "/v1.24/info") - assert.NilError(t, err) - assert.Check(t, is.DeepEqual(res.StatusCode, http.StatusOK)) - - b, err := req.ReadBody(body) - assert.NilError(t, err) - - // Verify the old response on API 1.24 and older before commit - // 6d98e344c7702a8a713cb9e02a19d83a79d3f930. - out := string(b) - assert.Check(t, is.Contains(out, "ExecutionDriver")) - assert.Check(t, is.Contains(out, "not supported")) -}