Jelajahi Sumber

Merge pull request #13338 from icecrime/13023_experimental_env_var

Add DOCKER_EXPERIMENTAL environment variable
Jessie Frazelle 10 tahun lalu
induk
melakukan
19790c46dc

+ 1 - 0
Makefile

@@ -7,6 +7,7 @@ DOCKER_ENVS := \
 	-e BUILDFLAGS \
 	-e BUILDFLAGS \
 	-e DOCKER_CLIENTONLY \
 	-e DOCKER_CLIENTONLY \
 	-e DOCKER_EXECDRIVER \
 	-e DOCKER_EXECDRIVER \
+	-e DOCKER_EXPERIMENTAL \
 	-e DOCKER_GRAPHDRIVER \
 	-e DOCKER_GRAPHDRIVER \
 	-e DOCKER_STORAGE_OPTS \
 	-e DOCKER_STORAGE_OPTS \
 	-e DOCKER_USERLANDPROXY \
 	-e DOCKER_USERLANDPROXY \

+ 1 - 0
api/client/info.go

@@ -87,6 +87,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 			fmt.Fprintf(cli.out, " %s\n", attribute)
 			fmt.Fprintf(cli.out, " %s\n", attribute)
 		}
 		}
 	}
 	}
+	fmt.Fprintf(cli.out, "Experimental: %t\n", info.ExperimentalBuild)
 
 
 	return nil
 	return nil
 }
 }

+ 1 - 0
api/types/types.go

@@ -168,6 +168,7 @@ type Info struct {
 	NoProxy            string
 	NoProxy            string
 	Name               string
 	Name               string
 	Labels             []string
 	Labels             []string
+	ExperimentalBuild  bool
 }
 }
 
 
 // This struct is a temp struct used by execStart
 // This struct is a temp struct used by execStart

+ 1 - 0
daemon/info.go

@@ -85,6 +85,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
 		MemTotal:           meminfo.MemTotal,
 		MemTotal:           meminfo.MemTotal,
 		DockerRootDir:      daemon.Config().Root,
 		DockerRootDir:      daemon.Config().Root,
 		Labels:             daemon.Config().Labels,
 		Labels:             daemon.Config().Labels,
+		ExperimentalBuild:  utils.ExperimentalBuild(),
 	}
 	}
 
 
 	if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
 	if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {

+ 5 - 0
docker/docker.go

@@ -16,6 +16,7 @@ import (
 	flag "github.com/docker/docker/pkg/mflag"
 	flag "github.com/docker/docker/pkg/mflag"
 	"github.com/docker/docker/pkg/reexec"
 	"github.com/docker/docker/pkg/reexec"
 	"github.com/docker/docker/pkg/term"
 	"github.com/docker/docker/pkg/term"
+	"github.com/docker/docker/utils"
 )
 )
 
 
 const (
 const (
@@ -59,6 +60,10 @@ func main() {
 		setLogLevel(logrus.DebugLevel)
 		setLogLevel(logrus.DebugLevel)
 	}
 	}
 
 
+	if utils.ExperimentalBuild() {
+		logrus.Warn("Running experimental build")
+	}
+
 	if len(flHosts) == 0 {
 	if len(flHosts) == 0 {
 		defaultHost := os.Getenv("DOCKER_HOST")
 		defaultHost := os.Getenv("DOCKER_HOST")
 		if defaultHost == "" || *flDaemon {
 		if defaultHost == "" || *flDaemon {

+ 1 - 0
docs/sources/reference/api/docker_remote_api_v1.19.md

@@ -1622,6 +1622,7 @@ Display system-wide information
             "Driver": "btrfs",
             "Driver": "btrfs",
             "DriverStatus": [[""]],
             "DriverStatus": [[""]],
             "ExecutionDriver": "native-0.1",
             "ExecutionDriver": "native-0.1",
+            "ExperimentalBuild": false,
             "HttpProxy": "http://test:test@localhost:8080",
             "HttpProxy": "http://test:test@localhost:8080",
             "HttpsProxy": "https://test:test@localhost:8080",
             "HttpsProxy": "https://test:test@localhost:8080",
             "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
             "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",

+ 6 - 0
hack/make.sh

@@ -93,6 +93,12 @@ if [ ! "$GOPATH" ]; then
 	exit 1
 	exit 1
 fi
 fi
 
 
+if [ "$DOCKER_EXPERIMENTAL" ]; then
+	echo >&2 '# WARNING! DOCKER_EXPERIMENTAL is set: building experimental features'
+	echo >&2
+	DOCKER_BUILDTAGS+=" experimental"
+fi
+
 if [ -z "$DOCKER_CLIENTONLY" ]; then
 if [ -z "$DOCKER_CLIENTONLY" ]; then
 	DOCKER_BUILDTAGS+=" daemon"
 	DOCKER_BUILDTAGS+=" daemon"
 fi
 fi

+ 7 - 0
utils/experimental.go

@@ -0,0 +1,7 @@
+// +build experimental
+
+package utils
+
+func ExperimentalBuild() bool {
+	return true
+}

+ 7 - 0
utils/stubs.go

@@ -0,0 +1,7 @@
+// +build !experimental
+
+package utils
+
+func ExperimentalBuild() bool {
+	return false
+}