Browse code

Add DOCKER_EXPERIMENTAL environment variable

The DOCKER_EXPERIMENTAL environment variable drives the activation of
the 'experimental' build tag.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>

Arnaud Porterie authored on 2015/05/20 07:09:58
Showing 9 changed files
... ...
@@ -7,6 +7,7 @@ DOCKER_ENVS := \
7 7
 	-e BUILDFLAGS \
8 8
 	-e DOCKER_CLIENTONLY \
9 9
 	-e DOCKER_EXECDRIVER \
10
+	-e DOCKER_EXPERIMENTAL \
10 11
 	-e DOCKER_GRAPHDRIVER \
11 12
 	-e DOCKER_STORAGE_OPTS \
12 13
 	-e TESTDIRS \
... ...
@@ -87,6 +87,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
87 87
 			fmt.Fprintf(cli.out, " %s\n", attribute)
88 88
 		}
89 89
 	}
90
+	fmt.Fprintf(cli.out, "Experimental: %t\n", info.ExperimentalBuild)
90 91
 
91 92
 	return nil
92 93
 }
... ...
@@ -168,6 +168,7 @@ type Info struct {
168 168
 	NoProxy            string
169 169
 	Name               string
170 170
 	Labels             []string
171
+	ExperimentalBuild  bool
171 172
 }
172 173
 
173 174
 // This struct is a temp struct used by execStart
... ...
@@ -85,6 +85,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
85 85
 		MemTotal:           meminfo.MemTotal,
86 86
 		DockerRootDir:      daemon.Config().Root,
87 87
 		Labels:             daemon.Config().Labels,
88
+		ExperimentalBuild:  utils.ExperimentalBuild(),
88 89
 	}
89 90
 
90 91
 	if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
... ...
@@ -16,6 +16,7 @@ import (
16 16
 	flag "github.com/docker/docker/pkg/mflag"
17 17
 	"github.com/docker/docker/pkg/reexec"
18 18
 	"github.com/docker/docker/pkg/term"
19
+	"github.com/docker/docker/utils"
19 20
 )
20 21
 
21 22
 const (
... ...
@@ -59,6 +60,10 @@ func main() {
59 59
 		setLogLevel(logrus.DebugLevel)
60 60
 	}
61 61
 
62
+	if utils.ExperimentalBuild() {
63
+		logrus.Warn("Running experimental build")
64
+	}
65
+
62 66
 	if len(flHosts) == 0 {
63 67
 		defaultHost := os.Getenv("DOCKER_HOST")
64 68
 		if defaultHost == "" || *flDaemon {
... ...
@@ -1620,6 +1620,7 @@ Display system-wide information
1620 1620
             "Driver": "btrfs",
1621 1621
             "DriverStatus": [[""]],
1622 1622
             "ExecutionDriver": "native-0.1",
1623
+            "ExperimentalBuild": false,
1623 1624
             "HttpProxy": "http://test:test@localhost:8080",
1624 1625
             "HttpsProxy": "https://test:test@localhost:8080",
1625 1626
             "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
... ...
@@ -93,6 +93,12 @@ if [ ! "$GOPATH" ]; then
93 93
 	exit 1
94 94
 fi
95 95
 
96
+if [ "$DOCKER_EXPERIMENTAL" ]; then
97
+	echo >&2 '# WARNING! DOCKER_EXPERIMENTAL is set: building experimental features'
98
+	echo >&2
99
+	DOCKER_BUILDTAGS+=" experimental"
100
+fi
101
+
96 102
 if [ -z "$DOCKER_CLIENTONLY" ]; then
97 103
 	DOCKER_BUILDTAGS+=" daemon"
98 104
 fi
99 105
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+// +build experimental
1
+
2
+package utils
3
+
4
+func ExperimentalBuild() bool {
5
+	return true
6
+}
0 7
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+// +build !experimental
1
+
2
+package utils
3
+
4
+func ExperimentalBuild() bool {
5
+	return false
6
+}