Merge pull request #863 from umohnani8/version

kpod version
This commit is contained in:
Daniel J Walsh 2017-09-11 12:10:11 -04:00 committed by GitHub
commit c56dcf2cb5
5 changed files with 19 additions and 2 deletions

1
KPOD_VERSION Normal file
View file

@ -0,0 +1 @@
0.1

View file

@ -20,6 +20,7 @@ GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMI
BUILD_INFO := $(shell date +%s)
VERSION := ${shell cat ./VERSION}
KPOD_VERSION := ${shell cat ./KPOD_VERSION}
# If GOPATH not specified, use one in the local directory
ifeq ($(GOPATH),)
@ -32,7 +33,7 @@ GOPKGBASEDIR := $(shell dirname "$(GOPKGDIR)")
# Update VPATH so make finds .gopathok
VPATH := $(VPATH):$(GOPATH)
LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO} -X main.version=${VERSION}'
LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO} -X main.version=${VERSION} -X main.kpodVersion=${KPOD_VERSION}'
all: binaries crio.conf docs

View file

@ -85,6 +85,8 @@ func debugInfo(c *cli.Context) (string, map[string]interface{}, error) {
info := map[string]interface{}{}
info["compiler"] = runtime.Compiler
info["go version"] = runtime.Version()
info["kpod version"] = c.App.Version
info["git commit"] = gitCommit
return "debug", info, nil
}

View file

@ -8,6 +8,10 @@ import (
"github.com/urfave/cli"
)
// This is populated by the Makefile from the VERSION file
// in the repository
var kpodVersion = ""
func main() {
if reexec.Init() {
return
@ -16,7 +20,12 @@ func main() {
app := cli.NewApp()
app.Name = "kpod"
app.Usage = "manage pods and images"
app.Version = "0.0.1"
var v string
if kpodVersion != "" {
v = kpodVersion
}
app.Version = v
app.Commands = []cli.Command{
diffCommand,

View file

@ -11,7 +11,11 @@ import (
// Overwritten at build time
var (
// gitCommit is the commit that the binary is being built from.
// It will be populated by the Makefile.
gitCommit string
// buildInfo is the time at which the binary was built
// It will be populated by the Makefile.
buildInfo string
)