From 9809d0c3ff5bb44a6f52ba36358046326e23f4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20M=C3=BCller?= Date: Tue, 23 Oct 2018 08:49:18 +0200 Subject: [PATCH] Bug/version (#75) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #67 | modify | remove not needed requirements Signed-off-by: Manuel Müller * #66 | fix | Getting started link Signed-off-by: Manuel Müller * #66 | modify | change path relative Signed-off-by: Manuel Müller * Update Documentation on master branch (#72) * Modified docs Signed-off-by: niki-1905 * Remove jmeter submodule, literatebee key, and empty vendor folder. Signed-off-by: Arush Salil * Update Dockerfile Signed-off-by: Arush Salil * Update Readme Signed-off-by: Arush Salil * Update AWS documentation Signed-off-by: Arush Salil * Add lifecycle documentation. Signed-off-by: Arush Salil * Fix typo Signed-off-by: Arush Salil Signed-off-by: Manuel Müller * Release/0 5 1 (#73) * Modified docs Signed-off-by: niki-1905 * Remove jmeter submodule, literatebee key, and empty vendor folder. Signed-off-by: Arush Salil * Update Dockerfile Signed-off-by: Arush Salil * Update Readme Signed-off-by: Arush Salil * Update AWS documentation Signed-off-by: Arush Salil * Add lifecycle documentation. Signed-off-by: Arush Salil * Fix typo Signed-off-by: Arush Salil * Refactor and add tests Signed-off-by: Manuel Müller * Update documentation * Update .gitignore * add pkg provisioner * Update Makefile * TK8-47 add infrastructure only flag https://kubernauts.atlassian.net/browse/TK8-47 Signed-off-by: Manuel Müller * BUG | Fix Version display The version is not display like accepted This will fix it Signed-off-by: Manuel Müller --- Makefile | 4 +++- cmd/cli/version.go | 3 ++- pkg/common/main.go | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 145f511..c025302 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ PROJECT := github.com/kubernauts/tk8 VERSION := $(shell git tag 2>/dev/null|tail -n 1) GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) -BUILD_FLAGS := -ldflags="-w -X $(PROJECT)/cmd.GITCOMMIT=$(GITCOMMIT) -X $(PROJECT)/cmd.VERSION=$(VERSION)" +BUILD_FLAGS := -ldflags "-w -s -X $(PROJECT)/pkg/common.GITCOMMIT=$(GITCOMMIT) -X $(PROJECT)/pkg/common.VERSION=$(VERSION)" + + default: bin diff --git a/cmd/cli/version.go b/cmd/cli/version.go index 9fa7ff8..3258316 100644 --- a/cmd/cli/version.go +++ b/cmd/cli/version.go @@ -17,6 +17,7 @@ package cmd import ( "fmt" + "github.com/kubernauts/tk8/pkg/common" "github.com/spf13/cobra" ) @@ -33,7 +34,7 @@ var versionCmd = &cobra.Command{ Long: `All software has versions. This is TK8's`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Version:" + VERSION + " (Build: " + GITCOMMIT + ")") + fmt.Println("Version:" + common.VERSION + " (Build: " + common.GITCOMMIT + ")") }, } diff --git a/pkg/common/main.go b/pkg/common/main.go index fe8cc5e..242afa5 100644 --- a/pkg/common/main.go +++ b/pkg/common/main.go @@ -8,7 +8,13 @@ import ( "path/filepath" ) -var Name string +var ( + Name string + // GITCOMMIT will hold the commit SHA to be used in the version command. + GITCOMMIT = "0" + // VERSION will hold the version number to be used in the version command. + VERSION = "dev" +) // ErrorCheck is responsbile to check if there is any error returned by a command. func ErrorCheck(msg string, err error) {