mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
version: added more version information
added more version information output to aid debugging print etcd Version, Git SHA, Go runtime version, OS and architecture Fixes #2560
This commit is contained in:
parent
b24dd8e4e6
commit
3914defd8a
6
build
6
build
@ -11,6 +11,8 @@ ln -s ${PWD} $GOPATH/src/${REPO_PATH}
|
|||||||
|
|
||||||
eval $(go env)
|
eval $(go env)
|
||||||
|
|
||||||
|
GIT_SHA=`git rev-parse --short HEAD`
|
||||||
|
|
||||||
# Static compilation is useful when etcd is run in a container
|
# Static compilation is useful when etcd is run in a container
|
||||||
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o bin/etcd ${REPO_PATH}
|
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA ${GIT_SHA}" -o bin/etcd ${REPO_PATH}
|
||||||
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o bin/etcdctl ${REPO_PATH}/etcdctl
|
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-s" -o bin/etcdctl ${REPO_PATH}/etcdctl
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/coreos/etcd/etcdserver"
|
"github.com/coreos/etcd/etcdserver"
|
||||||
@ -223,7 +224,10 @@ func (cfg *config) Parse(arguments []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cfg.printVersion {
|
if cfg.printVersion {
|
||||||
fmt.Println("etcd version", version.Version)
|
fmt.Printf("etcd Version: %s\n", version.Version)
|
||||||
|
fmt.Printf("Git SHA: %s\n", version.GitSHA)
|
||||||
|
fmt.Printf("Go Version: %s\n", runtime.Version())
|
||||||
|
fmt.Printf("Go OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ var (
|
|||||||
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
||||||
MinClusterVersion = "2.0.0"
|
MinClusterVersion = "2.0.0"
|
||||||
Version = "2.1.0-alpha.0+git"
|
Version = "2.1.0-alpha.0+git"
|
||||||
|
|
||||||
|
// Git SHA Value will be set during build
|
||||||
|
GitSHA = "Not provided (use ./build instead of go build)"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WalVersion is an enum for versions of etcd logs.
|
// WalVersion is an enum for versions of etcd logs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user