From ca6fdc6e4302431aee2488278829f07b7b2c35cf Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 14 Mar 2016 14:03:47 -0700 Subject: [PATCH 1/2] fix(version): use build version in helm --- cmd/expandybird/main.go | 2 +- cmd/helm/helm.go | 5 ++--- cmd/manager/main.go | 2 +- cmd/resourcifier/main.go | 2 +- pkg/version/version.go | 4 ++-- scripts/common.sh | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/expandybird/main.go b/cmd/expandybird/main.go index 332ffa33d..ac071cb55 100644 --- a/cmd/expandybird/main.go +++ b/cmd/expandybird/main.go @@ -48,7 +48,7 @@ func main() { } wrapper.Register(container) - log.Printf("Version: %s", version.DeploymentManagerVersion) + log.Printf("Version: %s", version.Version) log.Printf("Listening on %s...", address) log.Fatal(server.ListenAndServe()) } diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 3b26984ab..afe837220 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -21,10 +21,9 @@ import ( "github.com/codegangsta/cli" "github.com/kubernetes/deployment-manager/pkg/client" + "github.com/kubernetes/deployment-manager/pkg/version" ) -var version = "0.0.1" - var commands []cli.Command func init() { @@ -34,7 +33,7 @@ func init() { func main() { app := cli.NewApp() app.Name = "helm" - app.Version = version + app.Version = version.Version app.Usage = `Deploy and manage packages.` app.Commands = commands diff --git a/cmd/manager/main.go b/cmd/manager/main.go index a17369a7d..a4c5df85a 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -79,7 +79,7 @@ func main() { address := fmt.Sprintf(":%d", *port) handler := handlers.CombinedLoggingHandler(os.Stderr, router) - log.Printf("Version: %s", version.DeploymentManagerVersion) + log.Printf("Version: %s", version.Version) log.Printf("Listening on port %d...", *port) log.Fatal(http.ListenAndServe(address, handler)) } diff --git a/cmd/resourcifier/main.go b/cmd/resourcifier/main.go index 7d82e983a..83e267544 100644 --- a/cmd/resourcifier/main.go +++ b/cmd/resourcifier/main.go @@ -73,7 +73,7 @@ func main() { address := fmt.Sprintf(":%d", *port) handler := handlers.CombinedLoggingHandler(os.Stderr, router) - log.Printf("Version: %s", version.DeploymentManagerVersion) + log.Printf("Version: %s", version.Version) log.Printf("Listening on port %d...", *port) log.Fatal(http.ListenAndServe(address, handler)) } diff --git a/pkg/version/version.go b/pkg/version/version.go index fa1332c96..edcdf52ca 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -16,10 +16,10 @@ limitations under the License. package version -// DeploymentManagerVersion is the current version of the Deployment Manager. +// Version is the current version of the Deployment Manager. // Update this whenever making a new release. // The version is of the format Major.Minor.Patch // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. -var DeploymentManagerVersion = "0.0.1" +var Version = "0.0.1" diff --git a/scripts/common.sh b/scripts/common.sh index 3d8fc2643..d6c2fe6bc 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -32,7 +32,7 @@ assign_version() { assign_ldflags() { if [[ -z "${LDFLAGS:-}" ]]; then - LDFLAGS="-s -X ${REPO}/pkg/version.DeploymentManagerVersion=${VERSION}" + LDFLAGS="-s -X ${REPO}/pkg/version.Version=${VERSION}" fi } From d36ffedcdb44b13951d18ea5b8dec64355b97cbb Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 14 Mar 2016 14:16:47 -0700 Subject: [PATCH 2/2] fix(version): assign version at build --- scripts/common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/common.sh b/scripts/common.sh index d6c2fe6bc..0e08a8f7e 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -62,6 +62,9 @@ build_binaries() { targets=("${ALL_TARGETS[@]}") fi + assign_version + assign_ldflags + for t in "${targets[@]}"; do if [[ -n "$build_cross" ]]; then build_binary_cross "$t"