Skip to content

Commit 3653485

Browse files
committed
Update kpod version and info to show beta version
Signed-off-by: umohnani8 <[email protected]>
1 parent b8a6d35 commit 3653485

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

KPOD_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && ech
1818
GIT_COMMIT := $(shell git rev-parse --short HEAD)
1919
BUILD_INFO := $(shell date +%s)
2020

21+
KPOD_VERSION := ${shell cat ./KPOD_VERSION}
2122
# If GOPATH not specified, use one in the local directory
2223
ifeq ($(GOPATH),)
2324
export GOPATH := $(CURDIR)/_output
@@ -29,7 +30,7 @@ GOPKGBASEDIR := $(shell dirname "$(GOPKGDIR)")
2930
# Update VPATH so make finds .gopathok
3031
VPATH := $(VPATH):$(GOPATH)
3132

32-
LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO}'
33+
LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO} -X main.kpodVersion=${KPOD_VERSION}'
3334

3435
all: binaries crio.conf docs
3536

cmd/kpod/info.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ func debugInfo(c *cli.Context) (string, map[string]interface{}, error) {
8585
info := map[string]interface{}{}
8686
info["compiler"] = runtime.Compiler
8787
info["go version"] = runtime.Version()
88+
info["kpod version"] = c.App.Version
89+
info["git commit"] = gitCommit
8890
return "debug", info, nil
8991
}
9092

cmd/kpod/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import (
88
"github.com/urfave/cli"
99
)
1010

11+
// This is populated by the Makefile from the VERSION file
12+
// in the repository
13+
var kpodVersion = ""
14+
1115
func main() {
1216
if reexec.Init() {
1317
return
@@ -16,7 +20,12 @@ func main() {
1620
app := cli.NewApp()
1721
app.Name = "kpod"
1822
app.Usage = "manage pods and images"
19-
app.Version = "0.0.1"
23+
24+
var v string
25+
if kpodVersion != "" {
26+
v = kpodVersion
27+
}
28+
app.Version = v
2029

2130
app.Commands = []cli.Command{
2231
diffCommand,

cmd/kpod/version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import (
1111

1212
// Overwritten at build time
1313
var (
14+
// gitCommit is the commit that the binary is being built from.
15+
// It will be populated by the Makefile.
1416
gitCommit string
17+
// buildInfo is the time at which the binary was built
18+
// It will be populated by the Makefile.
1519
buildInfo string
1620
)
1721

0 commit comments

Comments
 (0)