mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Add API version to docker version
				
					
				
			Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
This commit is contained in:
		
							parent
							
								
									8ff02d58d9
								
							
						
					
					
						commit
						b246fc33ae
					
				
					 3 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -357,6 +357,7 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
 | 
			
		|||
	if dockerversion.VERSION != "" {
 | 
			
		||||
		fmt.Fprintf(cli.out, "Client version: %s\n", dockerversion.VERSION)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Fprintf(cli.out, "Client API version: %s\n", api.APIVERSION)
 | 
			
		||||
	fmt.Fprintf(cli.out, "Go version (client): %s\n", goruntime.Version())
 | 
			
		||||
	if dockerversion.GITCOMMIT != "" {
 | 
			
		||||
		fmt.Fprintf(cli.out, "Git commit (client): %s\n", dockerversion.GITCOMMIT)
 | 
			
		||||
| 
						 | 
				
			
			@ -379,6 +380,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
 | 
			
		|||
	}
 | 
			
		||||
	out.Close()
 | 
			
		||||
	fmt.Fprintf(cli.out, "Server version: %s\n", remoteVersion.Get("Version"))
 | 
			
		||||
	if apiVersion := remoteVersion.Get("ApiVersion"); apiVersion != "" {
 | 
			
		||||
		fmt.Fprintf(cli.out, "Server API version: %s\n", apiVersion)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Fprintf(cli.out, "Git commit (server): %s\n", remoteVersion.Get("GitCommit"))
 | 
			
		||||
	fmt.Fprintf(cli.out, "Go version (server): %s\n", remoteVersion.Get("GoVersion"))
 | 
			
		||||
	release := utils.GetReleaseVersion()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,17 @@ func TestVersionEnsureSucceeds(t *testing.T) {
 | 
			
		|||
		t.Fatal("failed to execute docker version")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stringsToCheck := []string{"Client version:", "Go version (client):", "Git commit (client):", "Server version:", "Git commit (server):", "Go version (server):", "Last stable version:"}
 | 
			
		||||
	stringsToCheck := []string{
 | 
			
		||||
		"Client version:",
 | 
			
		||||
		"Client API version:",
 | 
			
		||||
		"Go version (client):",
 | 
			
		||||
		"Git commit (client):",
 | 
			
		||||
		"Server version:",
 | 
			
		||||
		"Server API version:",
 | 
			
		||||
		"Git commit (server):",
 | 
			
		||||
		"Go version (server):",
 | 
			
		||||
		"Last stable version:",
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, linePrefix := range stringsToCheck {
 | 
			
		||||
		if !strings.Contains(out, linePrefix) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ package server
 | 
			
		|||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/dotcloud/docker/api"
 | 
			
		||||
	"github.com/dotcloud/docker/archive"
 | 
			
		||||
	"github.com/dotcloud/docker/daemonconfig"
 | 
			
		||||
	"github.com/dotcloud/docker/dockerversion"
 | 
			
		||||
| 
						 | 
				
			
			@ -823,6 +824,7 @@ func (srv *Server) DockerInfo(job *engine.Job) engine.Status {
 | 
			
		|||
func (srv *Server) DockerVersion(job *engine.Job) engine.Status {
 | 
			
		||||
	v := &engine.Env{}
 | 
			
		||||
	v.Set("Version", dockerversion.VERSION)
 | 
			
		||||
	v.Set("ApiVersion", api.APIVERSION)
 | 
			
		||||
	v.Set("GitCommit", dockerversion.GITCOMMIT)
 | 
			
		||||
	v.Set("GoVersion", goruntime.Version())
 | 
			
		||||
	v.Set("Os", goruntime.GOOS)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue