Browse code

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 <github@gone.nl>

Sebastiaan van Stijn authored on 2017/12/12 09:00:43
Showing 4 changed files
... ...
@@ -4,7 +4,7 @@ TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
4 4
 
5 5
 # When updating RUNC_COMMIT, also update runc in vendor.conf accordingly
6 6
 RUNC_COMMIT=b2567b37d7b75eb4cf325b77297b140ea686ce8f
7
-CONTAINERD_COMMIT=v1.0.0
7
+CONTAINERD_COMMIT=89623f28b87a6004d4b785663257362d1658a729 # v1.0.0
8 8
 TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574
9 9
 LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e
10 10
 VNDR_COMMIT=a6e196d8b4b0cbbdc29aebdb20c59ac6926bb384
... ...
@@ -1,13 +1,10 @@
1 1
 package main
2 2
 
3 3
 import (
4
-	"encoding/json"
5 4
 	"net/http"
6 5
 
7 6
 	"fmt"
8 7
 
9
-	"github.com/docker/docker/api/types"
10
-
11 8
 	"github.com/docker/docker/client"
12 9
 	"github.com/docker/docker/integration-cli/checker"
13 10
 	"github.com/docker/docker/integration-cli/request"
... ...
@@ -48,25 +45,6 @@ func (s *DockerSuite) TestInfoAPI(c *check.C) {
48 48
 	}
49 49
 }
50 50
 
51
-// TestInfoAPIRuncCommit tests that dockerd is able to obtain RunC version
52
-// information, and that the version matches the expected version
53
-func (s *DockerSuite) TestInfoAPIRuncCommit(c *check.C) {
54
-	testRequires(c, DaemonIsLinux) // Windows does not have RunC version information
55
-
56
-	res, body, err := request.Get("/v1.30/info")
57
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
58
-	c.Assert(err, checker.IsNil)
59
-
60
-	b, err := request.ReadBody(body)
61
-	c.Assert(err, checker.IsNil)
62
-
63
-	var i types.Info
64
-
65
-	c.Assert(json.Unmarshal(b, &i), checker.IsNil)
66
-	c.Assert(i.RuncCommit.ID, checker.Not(checker.Equals), "N/A")
67
-	c.Assert(i.RuncCommit.ID, checker.Equals, i.RuncCommit.Expected)
68
-}
69
-
70 51
 func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
71 52
 	testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
72 53
 
73 54
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+// +build !windows
1
+
2
+package system
3
+
4
+import (
5
+	"testing"
6
+
7
+	"github.com/docker/docker/integration/util/request"
8
+	"github.com/stretchr/testify/assert"
9
+	"github.com/stretchr/testify/require"
10
+	"golang.org/x/net/context"
11
+)
12
+
13
+func TestInfo_BinaryCommits(t *testing.T) {
14
+	client := request.NewAPIClient(t)
15
+
16
+	info, err := client.Info(context.Background())
17
+	require.NoError(t, err)
18
+
19
+	assert.NotNil(t, info.ContainerdCommit)
20
+	assert.NotEqual(t, "N/A", info.ContainerdCommit.ID)
21
+	assert.Equal(t, testEnv.DaemonInfo.ContainerdCommit.Expected, info.ContainerdCommit.Expected)
22
+	assert.Equal(t, info.ContainerdCommit.Expected, info.ContainerdCommit.ID)
23
+
24
+	assert.NotNil(t, info.InitCommit)
25
+	assert.NotEqual(t, "N/A", info.InitCommit.ID)
26
+	assert.Equal(t, testEnv.DaemonInfo.InitCommit.Expected, info.InitCommit.Expected)
27
+	assert.Equal(t, info.InitCommit.Expected, info.InitCommit.ID)
28
+
29
+	assert.NotNil(t, info.RuncCommit)
30
+	assert.NotEqual(t, "N/A", info.RuncCommit.ID)
31
+	assert.Equal(t, testEnv.DaemonInfo.RuncCommit.Expected, info.RuncCommit.Expected)
32
+	assert.Equal(t, info.RuncCommit.Expected, info.RuncCommit.ID)
33
+}
... ...
@@ -103,7 +103,7 @@ github.com/googleapis/gax-go da06d194a00e19ce00d9011a13931c3f6f6887c7
103 103
 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
104 104
 
105 105
 # containerd
106
-github.com/containerd/containerd v1.0.0
106
+github.com/containerd/containerd 89623f28b87a6004d4b785663257362d1658a729 # v1.0.0
107 107
 github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
108 108
 github.com/containerd/continuity 35d55c5e8dd23b32037d56cf97174aff3efdfa83
109 109
 github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f