From 6959a6fac2b6eab96d610d89cc988226c8a69b16 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 11 Dec 2017 16:00:43 -0800 Subject: [PATCH] Use commit-sha instead of tag for containerd The `docker info` command compares the installed version of containerd using a Git-sha. We currently use a tag for this, but that tag is not returned by the version-API of containerd, resulting in the `docker info` output to show: containerd version: 89623f28b87a6004d4b785663257362d1658a729 (expected: v1.0.0) This patch changes the `v1.0.0` tag to the commit that corresponds with the tag, so that the `docker info` output does not show the `expected:` string. This should be considered a temporary workaround; the check for the exact version of containerd that's installed was needed when we still used the 0.2.x branch, because it did not have stable releases yet. With containerd reaching 1.0, and using SemVer, we can likely do a comparison for "Major" version, or make this a "packaging" issue, and remove the check entirely (we can still _print_ the version that's installed if we think it's usefule). Signed-off-by: Sebastiaan van Stijn Upstream-commit: 2c8018f4bd7f48bf8f35770dea68f81b9591bb58 Component: engine --- .../engine/hack/dockerfile/binaries-commits | 2 +- .../integration-cli/docker_api_info_test.go | 22 ------------ .../integration/system/info_linux_test.go | 34 +++++++++++++++++++ components/engine/vendor.conf | 2 +- 4 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 components/engine/integration/system/info_linux_test.go diff --git a/components/engine/hack/dockerfile/binaries-commits b/components/engine/hack/dockerfile/binaries-commits index abe8bfe587..3b520828e3 100644 --- a/components/engine/hack/dockerfile/binaries-commits +++ b/components/engine/hack/dockerfile/binaries-commits @@ -4,7 +4,7 @@ TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a # When updating RUNC_COMMIT, also update runc in vendor.conf accordingly RUNC_COMMIT=b2567b37d7b75eb4cf325b77297b140ea686ce8f -CONTAINERD_COMMIT=v1.0.0 +CONTAINERD_COMMIT=89623f28b87a6004d4b785663257362d1658a729 # v1.0.0 TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574 LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e VNDR_COMMIT=a6e196d8b4b0cbbdc29aebdb20c59ac6926bb384 diff --git a/components/engine/integration-cli/docker_api_info_test.go b/components/engine/integration-cli/docker_api_info_test.go index 60ca4b928f..e7d77f0985 100644 --- a/components/engine/integration-cli/docker_api_info_test.go +++ b/components/engine/integration-cli/docker_api_info_test.go @@ -1,13 +1,10 @@ package main import ( - "encoding/json" "net/http" "fmt" - "github.com/docker/docker/api/types" - "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/request" @@ -48,25 +45,6 @@ func (s *DockerSuite) TestInfoAPI(c *check.C) { } } -// TestInfoAPIRuncCommit tests that dockerd is able to obtain RunC version -// information, and that the version matches the expected version -func (s *DockerSuite) TestInfoAPIRuncCommit(c *check.C) { - testRequires(c, DaemonIsLinux) // Windows does not have RunC version information - - res, body, err := request.Get("/v1.30/info") - c.Assert(res.StatusCode, checker.Equals, http.StatusOK) - c.Assert(err, checker.IsNil) - - b, err := request.ReadBody(body) - c.Assert(err, checker.IsNil) - - var i types.Info - - c.Assert(json.Unmarshal(b, &i), checker.IsNil) - c.Assert(i.RuncCommit.ID, checker.Not(checker.Equals), "N/A") - c.Assert(i.RuncCommit.ID, checker.Equals, i.RuncCommit.Expected) -} - func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) { testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later diff --git a/components/engine/integration/system/info_linux_test.go b/components/engine/integration/system/info_linux_test.go new file mode 100644 index 0000000000..bea14eaddd --- /dev/null +++ b/components/engine/integration/system/info_linux_test.go @@ -0,0 +1,34 @@ +// +build !windows + +package system + +import ( + "testing" + + "github.com/docker/docker/integration/util/request" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/net/context" +) + +func TestInfo_BinaryCommits(t *testing.T) { + client := request.NewAPIClient(t) + + info, err := client.Info(context.Background()) + require.NoError(t, err) + + assert.NotNil(t, info.ContainerdCommit) + assert.NotEqual(t, "N/A", info.ContainerdCommit.ID) + assert.Equal(t, testEnv.DaemonInfo.ContainerdCommit.Expected, info.ContainerdCommit.Expected) + assert.Equal(t, info.ContainerdCommit.Expected, info.ContainerdCommit.ID) + + assert.NotNil(t, info.InitCommit) + assert.NotEqual(t, "N/A", info.InitCommit.ID) + assert.Equal(t, testEnv.DaemonInfo.InitCommit.Expected, info.InitCommit.Expected) + assert.Equal(t, info.InitCommit.Expected, info.InitCommit.ID) + + assert.NotNil(t, info.RuncCommit) + assert.NotEqual(t, "N/A", info.RuncCommit.ID) + assert.Equal(t, testEnv.DaemonInfo.RuncCommit.Expected, info.RuncCommit.Expected) + assert.Equal(t, info.RuncCommit.Expected, info.RuncCommit.ID) +} diff --git a/components/engine/vendor.conf b/components/engine/vendor.conf index 87f7930262..93a503896f 100644 --- a/components/engine/vendor.conf +++ b/components/engine/vendor.conf @@ -103,7 +103,7 @@ github.com/googleapis/gax-go da06d194a00e19ce00d9011a13931c3f6f6887c7 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 # containerd -github.com/containerd/containerd v1.0.0 +github.com/containerd/containerd 89623f28b87a6004d4b785663257362d1658a729 # v1.0.0 github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6 github.com/containerd/continuity 35d55c5e8dd23b32037d56cf97174aff3efdfa83 github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f