From 6b737d09a792c072ef763583ca2b4ad489a2b214 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Fri, 19 Apr 2019 10:38:59 -0700 Subject: [PATCH 1/2] hardcode the imported versions of helm, kustomize and terraform --- Makefile | 6 ++++++ deploy/.goreleaser.unstable.yml | 3 +++ deploy/.goreleaser.yml | 3 +++ pkg/version/build.go | 1 + pkg/version/version.go | 22 ++++++++++++++++++---- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f3f4d59bb..7d86201a7 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ DOCKER_REPO ?= replicated VERSION_PACKAGE = github.com/replicatedhq/ship/pkg/version VERSION ?=`git describe --tags` DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` +HELMV = 2.13.0 +KUSTOMIZEV = 2.0.2 +TERRAFORMV = v0.11.13 GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null) ifneq "$(GIT_TREE)" "" @@ -36,6 +39,9 @@ define LDFLAGS -X ${VERSION_PACKAGE}.version=${VERSION} \ -X ${VERSION_PACKAGE}.gitSHA=${GIT_SHA} \ -X ${VERSION_PACKAGE}.buildTime=${DATE} \ + -X ${VERSION_PACKAGE}.helm=${HELMV} \ + -X ${VERSION_PACKAGE}.kustomize=${KUSTOMIZEV} \ + -X ${VERSION_PACKAGE}.terraform=${TERRAFORMV} \ " endef diff --git a/deploy/.goreleaser.unstable.yml b/deploy/.goreleaser.unstable.yml index b62f2db78..28a40ccbf 100644 --- a/deploy/.goreleaser.unstable.yml +++ b/deploy/.goreleaser.unstable.yml @@ -27,6 +27,9 @@ builds: -X github.com/replicatedhq/ship/pkg/version.version={{.Version}} -X github.com/replicatedhq/ship/pkg/version.gitSHA={{.Commit}} -X github.com/replicatedhq/ship/pkg/version.buildTime={{.Date}} + -X github.com/replicatedhq/ship/pkg/version.helm=2.13.0 + -X github.com/replicatedhq/ship/pkg/version.kustomize=2.0.2 + -X github.com/replicatedhq/ship/pkg/version.terraform=v0.11.13 -extldflags "-static" flags: -tags netgo -installsuffix netgo binary: ship diff --git a/deploy/.goreleaser.yml b/deploy/.goreleaser.yml index 2ee5682dc..6a5153b78 100644 --- a/deploy/.goreleaser.yml +++ b/deploy/.goreleaser.yml @@ -27,6 +27,9 @@ builds: -X github.com/replicatedhq/ship/pkg/version.version={{.Version}} -X github.com/replicatedhq/ship/pkg/version.gitSHA={{.Commit}} -X github.com/replicatedhq/ship/pkg/version.buildTime={{.Date}} + -X github.com/replicatedhq/ship/pkg/version.helm=2.13.0 + -X github.com/replicatedhq/ship/pkg/version.kustomize=2.0.2 + -X github.com/replicatedhq/ship/pkg/version.terraform=v0.11.13 -extldflags "-static" flags: -tags netgo -installsuffix netgo binary: ship diff --git a/pkg/version/build.go b/pkg/version/build.go index a79e72b1f..1ccbbae73 100644 --- a/pkg/version/build.go +++ b/pkg/version/build.go @@ -4,4 +4,5 @@ package version var ( version, gitSHA, buildTime string + helm, kustomize, terraform string ) diff --git a/pkg/version/version.go b/pkg/version/version.go index e7ce3ab7e..1e8b1847d 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -8,10 +8,17 @@ var ( // Build holds details about this build of the Ship binary type Build struct { - Version string `json:"version,omitempty"` - GitSHA string `json:"git,omitempty"` - BuildTime time.Time `json:"buildTime,omitempty"` - TimeFallback string `json:"buildTimeFallback,omitempty"` + Version string `json:"version,omitempty"` + GitSHA string `json:"git,omitempty"` + BuildTime time.Time `json:"buildTime,omitempty"` + TimeFallback string `json:"buildTimeFallback,omitempty"` + Dependencies BuildDependencies `json:"dependencies,omitempty"` +} + +type BuildDependencies struct { + Helm string `json:"helm,omitempty"` + Kustomize string `json:"kustomize,omitempty"` + Terraform string `json:"terraform,omitempty"` } // Init sets up the version info from build args @@ -25,6 +32,13 @@ func Init() { if err != nil { build.TimeFallback = buildTime } + + deps := BuildDependencies{ + Helm: helm, + Kustomize: kustomize, + Terraform: terraform, + } + build.Dependencies = deps } // GetBuild gets the build From f22ebeeb71532f5b19a44323e64f1f5589f3cf59 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Fri, 19 Apr 2019 11:24:11 -0700 Subject: [PATCH 2/2] make version formatting consistent --- Makefile | 4 ++-- deploy/.goreleaser.unstable.yml | 4 ++-- deploy/.goreleaser.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7d86201a7..8ff006a47 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,8 @@ DOCKER_REPO ?= replicated VERSION_PACKAGE = github.com/replicatedhq/ship/pkg/version VERSION ?=`git describe --tags` DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -HELMV = 2.13.0 -KUSTOMIZEV = 2.0.2 +HELMV = v2.13.0 +KUSTOMIZEV = v2.0.2 TERRAFORMV = v0.11.13 GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null) diff --git a/deploy/.goreleaser.unstable.yml b/deploy/.goreleaser.unstable.yml index 28a40ccbf..5ec510ecb 100644 --- a/deploy/.goreleaser.unstable.yml +++ b/deploy/.goreleaser.unstable.yml @@ -27,8 +27,8 @@ builds: -X github.com/replicatedhq/ship/pkg/version.version={{.Version}} -X github.com/replicatedhq/ship/pkg/version.gitSHA={{.Commit}} -X github.com/replicatedhq/ship/pkg/version.buildTime={{.Date}} - -X github.com/replicatedhq/ship/pkg/version.helm=2.13.0 - -X github.com/replicatedhq/ship/pkg/version.kustomize=2.0.2 + -X github.com/replicatedhq/ship/pkg/version.helm=v2.13.0 + -X github.com/replicatedhq/ship/pkg/version.kustomize=v2.0.2 -X github.com/replicatedhq/ship/pkg/version.terraform=v0.11.13 -extldflags "-static" flags: -tags netgo -installsuffix netgo diff --git a/deploy/.goreleaser.yml b/deploy/.goreleaser.yml index 6a5153b78..b505dafd7 100644 --- a/deploy/.goreleaser.yml +++ b/deploy/.goreleaser.yml @@ -27,8 +27,8 @@ builds: -X github.com/replicatedhq/ship/pkg/version.version={{.Version}} -X github.com/replicatedhq/ship/pkg/version.gitSHA={{.Commit}} -X github.com/replicatedhq/ship/pkg/version.buildTime={{.Date}} - -X github.com/replicatedhq/ship/pkg/version.helm=2.13.0 - -X github.com/replicatedhq/ship/pkg/version.kustomize=2.0.2 + -X github.com/replicatedhq/ship/pkg/version.helm=v2.13.0 + -X github.com/replicatedhq/ship/pkg/version.kustomize=v2.0.2 -X github.com/replicatedhq/ship/pkg/version.terraform=v0.11.13 -extldflags "-static" flags: -tags netgo -installsuffix netgo