Skip to content

Commit 9c4e10a

Browse files
author
Vaughn Dice
committed
feat(version): add build version to deis -v output
1 parent 90c0dd1 commit 9c4e10a

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

client/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ bootstrap:
4242
glideup:
4343
${DEV_ENV_CMD} glide up
4444

45-
build:
46-
${DEV_ENV_CMD} make binary-build
45+
build: binary-build
4746
@$(call check-static-binary,deis)
4847

4948
build-all:
@@ -53,7 +52,7 @@ build-all:
5352
-output="$(DIST_DIR)/deis-${VERSION}-{{.OS}}-{{.Arch}}" .
5453

5554
binary-build:
56-
go build -a -installsuffix cgo -ldflags '-s' -o deis .
55+
${DEV_ENV_CMD} go build -a -installsuffix cgo -ldflags "-s -X ${repo_path}/version.BuildVersion=${VERSION}" -o deis .
5756

5857
dist: build-all
5958

client/parser/version.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Use 'deis help [command]' to learn more.
2020
return err
2121
}
2222

23-
fmt.Println(version.Version)
23+
v := version.Version
24+
if version.BuildVersion != "" {
25+
v = fmt.Sprintf("%s-%s", version.Version, version.BuildVersion)
26+
}
27+
fmt.Println(v)
28+
2429
return nil
2530
}

client/version/version.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ const Version = "2.0.0-dev"
55

66
// API identifies the latest Deis api verison
77
const APIVersion = "2.0"
8+
9+
// Note: This value is overwritten by the linker during build
10+
var BuildVersion = ""

0 commit comments

Comments
 (0)