Browse code

Merge pull request #13568 from jfrazelle/fix-release-script-for-experimental

fix release script for experimental

Phil Estes authored on 2015/06/02 01:29:45
Showing 7 changed files
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"github.com/docker/docker/api/types"
10 10
 	"github.com/docker/docker/autogen/dockerversion"
11 11
 	flag "github.com/docker/docker/pkg/mflag"
12
+	"github.com/docker/docker/utils"
12 13
 )
13 14
 
14 15
 // CmdVersion shows Docker version information.
... ...
@@ -31,6 +32,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
31 31
 		fmt.Fprintf(cli.out, "Git commit (client): %s\n", dockerversion.GITCOMMIT)
32 32
 	}
33 33
 	fmt.Fprintf(cli.out, "OS/Arch (client): %s/%s\n", runtime.GOOS, runtime.GOARCH)
34
+	if utils.ExperimentalBuild() {
35
+		fmt.Fprintf(cli.out, "Experimental (client): true\n")
36
+	}
34 37
 
35 38
 	stream, _, err := cli.call("GET", "/version", nil, nil)
36 39
 	if err != nil {
... ...
@@ -50,6 +54,8 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
50 50
 	fmt.Fprintf(cli.out, "Go version (server): %s\n", v.GoVersion)
51 51
 	fmt.Fprintf(cli.out, "Git commit (server): %s\n", v.GitCommit)
52 52
 	fmt.Fprintf(cli.out, "OS/Arch (server): %s/%s\n", v.Os, v.Arch)
53
-
53
+	if v.Experimental {
54
+		fmt.Fprintf(cli.out, "Experimental (server): true\n")
55
+	}
54 56
 	return nil
55 57
 }
... ...
@@ -246,12 +246,13 @@ func (s *Server) postAuth(version version.Version, w http.ResponseWriter, r *htt
246 246
 
247 247
 func (s *Server) getVersion(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
248 248
 	v := &types.Version{
249
-		Version:    dockerversion.VERSION,
250
-		ApiVersion: api.APIVERSION,
251
-		GitCommit:  dockerversion.GITCOMMIT,
252
-		GoVersion:  runtime.Version(),
253
-		Os:         runtime.GOOS,
254
-		Arch:       runtime.GOARCH,
249
+		Version:      dockerversion.VERSION,
250
+		ApiVersion:   api.APIVERSION,
251
+		GitCommit:    dockerversion.GITCOMMIT,
252
+		GoVersion:    runtime.Version(),
253
+		Os:           runtime.GOOS,
254
+		Arch:         runtime.GOARCH,
255
+		Experimental: utils.ExperimentalBuild(),
255 256
 	}
256 257
 	if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
257 258
 		v.KernelVersion = kernelVersion.String()
... ...
@@ -132,6 +132,7 @@ type Version struct {
132 132
 	Os            string
133 133
 	Arch          string
134 134
 	KernelVersion string `json:",omitempty"`
135
+	Experimental  bool
135 136
 }
136 137
 
137 138
 // GET "/info"
... ...
@@ -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 (
... ...
@@ -161,5 +162,9 @@ func main() {
161 161
 }
162 162
 
163 163
 func showVersion() {
164
-	fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT)
164
+	if utils.ExperimentalBuild() {
165
+		fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.VERSION, dockerversion.GITCOMMIT)
166
+	} else {
167
+		fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT)
168
+	}
165 169
 }
... ...
@@ -1609,7 +1609,8 @@ Show the docker version information
1609 1609
          "GoVersion": "go1.4.1",
1610 1610
          "GitCommit": "a8a31ef",
1611 1611
          "Arch": "amd64",
1612
-         "ApiVersion": "1.19"
1612
+         "ApiVersion": "1.20",
1613
+         "Experimental": false
1613 1614
     }
1614 1615
 
1615 1616
 Status Codes:
... ...
@@ -96,7 +96,6 @@ fi
96 96
 if [ "$DOCKER_EXPERIMENTAL" ]; then
97 97
 	echo >&2 '# WARNING! DOCKER_EXPERIMENTAL is set: building experimental features'
98 98
 	echo >&2
99
-	VERSION+="-experimental"
100 99
 	DOCKER_BUILDTAGS+=" experimental"
101 100
 fi
102 101
 
... ...
@@ -17,8 +17,13 @@ func (s *DockerSuite) TestExperimentalVersion(c *check.C) {
17 17
 	}
18 18
 
19 19
 	for _, line := range strings.Split(out, "\n") {
20
-		if strings.HasPrefix(line, "Client version:") || strings.HasPrefix(line, "Server version:") {
21
-			c.Assert(line, check.Matches, "*-experimental")
20
+		if strings.HasPrefix(line, "Experimental (client):") || strings.HasPrefix(line, "Experimental (server):") {
21
+			c.Assert(line, check.Matches, "*true")
22 22
 		}
23 23
 	}
24
+
25
+	versionCmd = exec.Command(dockerBinary, "-v")
26
+	if out, _, err = runCommandWithOutput(versionCmd); err != nil || !strings.Contains(out, ", experimental") {
27
+		c.Fatalf("docker version did not contain experimental: %s, %v", out, err)
28
+	}
24 29
 }