From b372f9f224d2dcc2a7beca55751782060dc9b12f Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Thu, 28 May 2015 17:59:07 -0700 Subject: [PATCH] fix experimental version and release script add api version experimental Signed-off-by: Jessica Frazelle --- api/client/version.go | 8 +++++++- api/server/server.go | 13 +++++++------ api/types/types.go | 1 + docker/docker.go | 7 ++++++- .../reference/api/docker_remote_api_v1.20.md | 3 ++- hack/make.sh | 1 - integration-cli/docker_cli_experimental_test.go | 9 +++++++-- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/api/client/version.go b/api/client/version.go index bc215c7423..29e714da8b 100644 --- a/api/client/version.go +++ b/api/client/version.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/autogen/dockerversion" flag "github.com/docker/docker/pkg/mflag" + "github.com/docker/docker/utils" ) // CmdVersion shows Docker version information. @@ -31,6 +32,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error { fmt.Fprintf(cli.out, "Git commit (client): %s\n", dockerversion.GITCOMMIT) } fmt.Fprintf(cli.out, "OS/Arch (client): %s/%s\n", runtime.GOOS, runtime.GOARCH) + if utils.ExperimentalBuild() { + fmt.Fprintf(cli.out, "Experimental (client): true\n") + } stream, _, err := cli.call("GET", "/version", nil, nil) if err != nil { @@ -50,6 +54,8 @@ func (cli *DockerCli) CmdVersion(args ...string) error { fmt.Fprintf(cli.out, "Go version (server): %s\n", v.GoVersion) fmt.Fprintf(cli.out, "Git commit (server): %s\n", v.GitCommit) fmt.Fprintf(cli.out, "OS/Arch (server): %s/%s\n", v.Os, v.Arch) - + if v.Experimental { + fmt.Fprintf(cli.out, "Experimental (server): true\n") + } return nil } diff --git a/api/server/server.go b/api/server/server.go index 1fa629acaa..faf7b7beb9 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -246,12 +246,13 @@ func (s *Server) postAuth(version version.Version, w http.ResponseWriter, r *htt func (s *Server) getVersion(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { v := &types.Version{ - Version: dockerversion.VERSION, - ApiVersion: api.APIVERSION, - GitCommit: dockerversion.GITCOMMIT, - GoVersion: runtime.Version(), - Os: runtime.GOOS, - Arch: runtime.GOARCH, + Version: dockerversion.VERSION, + ApiVersion: api.APIVERSION, + GitCommit: dockerversion.GITCOMMIT, + GoVersion: runtime.Version(), + Os: runtime.GOOS, + Arch: runtime.GOARCH, + Experimental: utils.ExperimentalBuild(), } if kernelVersion, err := kernel.GetKernelVersion(); err == nil { v.KernelVersion = kernelVersion.String() diff --git a/api/types/types.go b/api/types/types.go index 457808f5e9..6d0d7bca21 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -132,6 +132,7 @@ type Version struct { Os string Arch string KernelVersion string `json:",omitempty"` + Experimental bool } // GET "/info" diff --git a/docker/docker.go b/docker/docker.go index fd40f4b422..092e04fc83 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -16,6 +16,7 @@ import ( flag "github.com/docker/docker/pkg/mflag" "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/term" + "github.com/docker/docker/utils" ) const ( @@ -161,5 +162,9 @@ func main() { } func showVersion() { - fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT) + if utils.ExperimentalBuild() { + fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.VERSION, dockerversion.GITCOMMIT) + } else { + fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT) + } } diff --git a/docs/sources/reference/api/docker_remote_api_v1.20.md b/docs/sources/reference/api/docker_remote_api_v1.20.md index ae6cfe94b9..96ed2acb07 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.20.md +++ b/docs/sources/reference/api/docker_remote_api_v1.20.md @@ -1687,7 +1687,8 @@ Show the docker version information "GoVersion": "go1.4.1", "GitCommit": "a8a31ef", "Arch": "amd64", - "ApiVersion": "1.19" + "ApiVersion": "1.20", + "Experimental": false } Status Codes: diff --git a/hack/make.sh b/hack/make.sh index 7af07a1dd0..d01fa187fa 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -96,7 +96,6 @@ fi if [ "$DOCKER_EXPERIMENTAL" ]; then echo >&2 '# WARNING! DOCKER_EXPERIMENTAL is set: building experimental features' echo >&2 - VERSION+="-experimental" DOCKER_BUILDTAGS+=" experimental" fi diff --git a/integration-cli/docker_cli_experimental_test.go b/integration-cli/docker_cli_experimental_test.go index 4cf05c91f9..26bab8544a 100644 --- a/integration-cli/docker_cli_experimental_test.go +++ b/integration-cli/docker_cli_experimental_test.go @@ -17,8 +17,13 @@ func (s *DockerSuite) TestExperimentalVersion(c *check.C) { } for _, line := range strings.Split(out, "\n") { - if strings.HasPrefix(line, "Client version:") || strings.HasPrefix(line, "Server version:") { - c.Assert(line, check.Matches, "*-experimental") + if strings.HasPrefix(line, "Experimental (client):") || strings.HasPrefix(line, "Experimental (server):") { + c.Assert(line, check.Matches, "*true") } } + + versionCmd = exec.Command(dockerBinary, "-v") + if out, _, err = runCommandWithOutput(versionCmd); err != nil || !strings.Contains(out, ", experimental") { + c.Fatalf("docker version did not contain experimental: %s, %v", out, err) + } }