Browse code

info: remove "expected" check for tini version

These checks were added when we required a specific version of containerd
and runc (different versions were known to be incompatible). I don't think
we had a similar requirement for tini, so this check was redundant. Let's
remove the check altogether.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2021/08/23 20:19:31
Showing 3 changed files
... ...
@@ -11,7 +11,6 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	containertypes "github.com/docker/docker/api/types/container"
14
-	"github.com/docker/docker/dockerversion"
15 14
 	"github.com/docker/docker/pkg/sysinfo"
16 15
 	"github.com/pkg/errors"
17 16
 	"github.com/sirupsen/logrus"
... ...
@@ -38,55 +37,44 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
38 38
 	v.Runtimes = daemon.configStore.GetAllRuntimes()
39 39
 	v.DefaultRuntime = daemon.configStore.GetDefaultRuntimeName()
40 40
 	v.InitBinary = daemon.configStore.GetInitPath()
41
+	v.RuncCommit.ID = "N/A"
42
+	v.ContainerdCommit.ID = "N/A"
43
+	v.InitCommit.ID = "N/A"
41 44
 
42 45
 	defaultRuntimeBinary := daemon.configStore.GetRuntime(v.DefaultRuntime).Path
43 46
 	if rv, err := exec.Command(defaultRuntimeBinary, "--version").Output(); err == nil {
44 47
 		if _, _, commit, err := parseRuntimeVersion(string(rv)); err != nil {
45 48
 			logrus.Warnf("failed to parse %s version: %v", defaultRuntimeBinary, err)
46
-			v.RuncCommit.ID = "N/A"
47 49
 		} else {
48 50
 			v.RuncCommit.ID = commit
49 51
 		}
50 52
 	} else {
51 53
 		logrus.Warnf("failed to retrieve %s version: %v", defaultRuntimeBinary, err)
52
-		v.RuncCommit.ID = "N/A"
53 54
 	}
54 55
 
55
-	// runc is now shipped as a separate package. Set "expected" to same value
56
-	// as "ID" to prevent clients from reporting a version-mismatch
57
-	v.RuncCommit.Expected = v.RuncCommit.ID
58
-
59 56
 	if rv, err := daemon.containerd.Version(context.Background()); err == nil {
60 57
 		v.ContainerdCommit.ID = rv.Revision
61 58
 	} else {
62 59
 		logrus.Warnf("failed to retrieve containerd version: %v", err)
63
-		v.ContainerdCommit.ID = "N/A"
64 60
 	}
65 61
 
66
-	// containerd is now shipped as a separate package. Set "expected" to same
67
-	// value as "ID" to prevent clients from reporting a version-mismatch
68
-	v.ContainerdCommit.Expected = v.ContainerdCommit.ID
69
-
70
-	// TODO is there still a need to check the expected version for tini?
71
-	// if not, we can change this, and just set "Expected" to v.InitCommit.ID
72
-	v.InitCommit.Expected = dockerversion.InitCommitID
73
-
74 62
 	defaultInitBinary := daemon.configStore.GetInitPath()
75 63
 	if rv, err := exec.Command(defaultInitBinary, "--version").Output(); err == nil {
76 64
 		if _, commit, err := parseInitVersion(string(rv)); err != nil {
77 65
 			logrus.Warnf("failed to parse %s version: %s", defaultInitBinary, err)
78
-			v.InitCommit.ID = "N/A"
79 66
 		} else {
80 67
 			v.InitCommit.ID = commit
81
-			if len(dockerversion.InitCommitID) > len(commit) {
82
-				v.InitCommit.Expected = dockerversion.InitCommitID[0:len(commit)]
83
-			}
84 68
 		}
85 69
 	} else {
86 70
 		logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)
87
-		v.InitCommit.ID = "N/A"
88 71
 	}
89 72
 
73
+	// Set expected and actual commits to the same value to prevent the client
74
+	// showing that the version does not match the "expected" version/commit.
75
+	v.RuncCommit.Expected = v.RuncCommit.ID
76
+	v.ContainerdCommit.Expected = v.ContainerdCommit.ID
77
+	v.InitCommit.Expected = v.InitCommit.ID
78
+
90 79
 	if v.CgroupDriver == cgroupNoneDriver {
91 80
 		if v.CgroupVersion == "2" {
92 81
 			v.Warnings = append(v.Warnings, "WARNING: Running in rootless-mode without cgroups. Systemd is required to enable cgroups in rootless-mode.")
... ...
@@ -10,7 +10,6 @@ var (
10 10
 	Version               = "library-import"
11 11
 	BuildTime             = "library-import"
12 12
 	IAmStatic             = "library-import"
13
-	InitCommitID          = "library-import"
14 13
 	PlatformName          = ""
15 14
 	ProductName           = ""
16 15
 	DefaultProductLicense = ""
... ...
@@ -14,7 +14,6 @@ LDFLAGS="${LDFLAGS} \
14 14
 	-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \
15 15
 	-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \
16 16
 	-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" \
17
-	-X \"github.com/docker/docker/dockerversion.InitCommitID=${TINI_COMMIT}\" \
18 17
 "
19 18
 
20 19
 # Compile the Windows resources into the sources