Skip to content

Commit ca6722f

Browse files
author
Arnaud Porterie
committed
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>
1 parent 0cc5da0 commit ca6722f

File tree

9 files changed

+30
-0
lines changed

9 files changed

+30
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ DOCKER_ENVS := \
77
-e BUILDFLAGS \
88
-e DOCKER_CLIENTONLY \
99
-e DOCKER_EXECDRIVER \
10+
-e DOCKER_EXPERIMENTAL \
1011
-e DOCKER_GRAPHDRIVER \
1112
-e DOCKER_STORAGE_OPTS \
1213
-e TESTDIRS \

api/client/info.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
8787
fmt.Fprintf(cli.out, " %s\n", attribute)
8888
}
8989
}
90+
fmt.Fprintf(cli.out, "Experimental: %t\n", info.ExperimentalBuild)
9091

9192
return nil
9293
}

api/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ type Info struct {
168168
NoProxy string
169169
Name string
170170
Labels []string
171+
ExperimentalBuild bool
171172
}
172173

173174
// This struct is a temp struct used by execStart

daemon/info.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
8585
MemTotal: meminfo.MemTotal,
8686
DockerRootDir: daemon.Config().Root,
8787
Labels: daemon.Config().Labels,
88+
ExperimentalBuild: utils.ExperimentalBuild(),
8889
}
8990

9091
if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {

docker/docker.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
flag "github.com/docker/docker/pkg/mflag"
1717
"github.com/docker/docker/pkg/reexec"
1818
"github.com/docker/docker/pkg/term"
19+
"github.com/docker/docker/utils"
1920
)
2021

2122
const (
@@ -59,6 +60,10 @@ func main() {
5960
setLogLevel(logrus.DebugLevel)
6061
}
6162

63+
if utils.ExperimentalBuild() {
64+
logrus.Warn("Running experimental build")
65+
}
66+
6267
if len(flHosts) == 0 {
6368
defaultHost := os.Getenv("DOCKER_HOST")
6469
if defaultHost == "" || *flDaemon {

docs/sources/reference/api/docker_remote_api_v1.19.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,7 @@ Display system-wide information
16201620
"Driver": "btrfs",
16211621
"DriverStatus": [[""]],
16221622
"ExecutionDriver": "native-0.1",
1623+
"ExperimentalBuild": false,
16231624
"HttpProxy": "http://test:test@localhost:8080",
16241625
"HttpsProxy": "https://test:test@localhost:8080",
16251626
"ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",

hack/make.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ if [ ! "$GOPATH" ]; then
9393
exit 1
9494
fi
9595

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+
96102
if [ -z "$DOCKER_CLIENTONLY" ]; then
97103
DOCKER_BUILDTAGS+=" daemon"
98104
fi

utils/experimental.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build experimental
2+
3+
package utils
4+
5+
func ExperimentalBuild() bool {
6+
return true
7+
}

utils/stubs.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build !experimental
2+
3+
package utils
4+
5+
func ExperimentalBuild() bool {
6+
return false
7+
}

0 commit comments

Comments
 (0)