commit
c56dcf2cb5
5 changed files with 19 additions and 2 deletions
1
KPOD_VERSION
Normal file
1
KPOD_VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
0.1
|
3
Makefile
3
Makefile
|
@ -20,6 +20,7 @@ GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMI
|
||||||
BUILD_INFO := $(shell date +%s)
|
BUILD_INFO := $(shell date +%s)
|
||||||
|
|
||||||
VERSION := ${shell cat ./VERSION}
|
VERSION := ${shell cat ./VERSION}
|
||||||
|
KPOD_VERSION := ${shell cat ./KPOD_VERSION}
|
||||||
|
|
||||||
# If GOPATH not specified, use one in the local directory
|
# If GOPATH not specified, use one in the local directory
|
||||||
ifeq ($(GOPATH),)
|
ifeq ($(GOPATH),)
|
||||||
|
@ -32,7 +33,7 @@ GOPKGBASEDIR := $(shell dirname "$(GOPKGDIR)")
|
||||||
# Update VPATH so make finds .gopathok
|
# Update VPATH so make finds .gopathok
|
||||||
VPATH := $(VPATH):$(GOPATH)
|
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
|
all: binaries crio.conf docs
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ func debugInfo(c *cli.Context) (string, map[string]interface{}, error) {
|
||||||
info := map[string]interface{}{}
|
info := map[string]interface{}{}
|
||||||
info["compiler"] = runtime.Compiler
|
info["compiler"] = runtime.Compiler
|
||||||
info["go version"] = runtime.Version()
|
info["go version"] = runtime.Version()
|
||||||
|
info["kpod version"] = c.App.Version
|
||||||
|
info["git commit"] = gitCommit
|
||||||
return "debug", info, nil
|
return "debug", info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This is populated by the Makefile from the VERSION file
|
||||||
|
// in the repository
|
||||||
|
var kpodVersion = ""
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if reexec.Init() {
|
if reexec.Init() {
|
||||||
return
|
return
|
||||||
|
@ -16,7 +20,12 @@ func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "kpod"
|
app.Name = "kpod"
|
||||||
app.Usage = "manage pods and images"
|
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{
|
app.Commands = []cli.Command{
|
||||||
diffCommand,
|
diffCommand,
|
||||||
|
|
|
@ -11,7 +11,11 @@ import (
|
||||||
|
|
||||||
// Overwritten at build time
|
// Overwritten at build time
|
||||||
var (
|
var (
|
||||||
|
// gitCommit is the commit that the binary is being built from.
|
||||||
|
// It will be populated by the Makefile.
|
||||||
gitCommit string
|
gitCommit string
|
||||||
|
// buildInfo is the time at which the binary was built
|
||||||
|
// It will be populated by the Makefile.
|
||||||
buildInfo string
|
buildInfo string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue