From 5e8afd3d0ec0bc726c5dc7d67588bdd44ab55ca3 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 4 Jul 2023 14:45:33 +0100 Subject: [PATCH] See https://hashicorp.atlassian.net/browse/RELENG-619 - version updates to better support CRT/VBA. --- .github/workflows/build-waypoint-oss.yml | 2 -- Makefile | 2 +- internal/ceb/ceb.go | 2 +- internal/ceb/url.go | 2 +- internal/cli/deployment_list.go | 2 +- internal/cli/main.go | 4 ++-- internal/cli/release_list.go | 2 +- internal/cli/status.go | 2 +- internal/cli/version.go | 2 +- pkg/protocolversion/current.go | 2 +- version/VERSION | 2 +- {internal/version => version}/version.go | 11 ++++++++--- 12 files changed, 19 insertions(+), 16 deletions(-) rename {internal/version => version}/version.go (82%) diff --git a/.github/workflows/build-waypoint-oss.yml b/.github/workflows/build-waypoint-oss.yml index f673a0ebf94..184f10b40c5 100644 --- a/.github/workflows/build-waypoint-oss.yml +++ b/.github/workflows/build-waypoint-oss.yml @@ -72,8 +72,6 @@ jobs: GOARCH: ${{ inputs.goarch }} WAYPOINT_GOOS: ${{ inputs.goos }} WAYPOINT_GOARCH: ${{ inputs.goarch }} - BASE_VERSION: ${{ inputs.waypoint-base-version }} - PRERELEASE: ${{ inputs.waypoint-prerelease }} CGO_ENABLED: ${{ inputs.cgo-enabled }} CRT_BIN_NAME: ${{ steps.get-bin-name.outputs.bin-name }} uses: hashicorp/actions-go-build@v0.1.9 diff --git a/Makefile b/Makefile index 14d71a52c69..5d788af1ed4 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ GIT_DIRTY=$$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) GIT_DESCRIBE=$$(git describe --tags --always --match "v*") GIT_IMPORT="github.com/hashicorp/waypoint/internal/version" GOLDFLAGS="-s -w -X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY) -X $(GIT_IMPORT).GitDescribe=$(GIT_DESCRIBE)" -CRT_GOLDFLAGS="-s -w -X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY) -X $(GIT_IMPORT).Version=$(BASE_VERSION) -X $(GIT_IMPORT).VersionPrerelease=$(PRERELEASE)" +CRT_GOLDFLAGS="-s -w -X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY)" GO_CMD?=go CGO_ENABLED?=0 WP_SERVER_PLATFORM?="linux/amd64" diff --git a/internal/ceb/ceb.go b/internal/ceb/ceb.go index 05c48ec2d71..a1a08e554c6 100644 --- a/internal/ceb/ceb.go +++ b/internal/ceb/ceb.go @@ -9,6 +9,7 @@ package ceb import ( "context" "fmt" + "github.com/hashicorp/waypoint/version" "os" "os/exec" "strconv" @@ -22,7 +23,6 @@ import ( "github.com/hashicorp/waypoint/internal/env" "github.com/hashicorp/waypoint/internal/pkg/gatedwriter" "github.com/hashicorp/waypoint/internal/plugin" - "github.com/hashicorp/waypoint/internal/version" "github.com/hashicorp/waypoint/pkg/server" pb "github.com/hashicorp/waypoint/pkg/server/gen" ) diff --git a/internal/ceb/url.go b/internal/ceb/url.go index 58ecbe69aa2..a6ffe155465 100644 --- a/internal/ceb/url.go +++ b/internal/ceb/url.go @@ -6,6 +6,7 @@ package ceb import ( "context" "fmt" + "github.com/hashicorp/waypoint/version" "github.com/certifi/gocertifi" "github.com/hashicorp/horizon/pkg/agent" @@ -13,7 +14,6 @@ import ( hznpb "github.com/hashicorp/horizon/pkg/pb" "github.com/pkg/errors" - "github.com/hashicorp/waypoint/internal/version" pb "github.com/hashicorp/waypoint/pkg/server/gen" ) diff --git a/internal/cli/deployment_list.go b/internal/cli/deployment_list.go index ff421a0c01e..1f5758524ac 100644 --- a/internal/cli/deployment_list.go +++ b/internal/cli/deployment_list.go @@ -7,6 +7,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/hashicorp/waypoint/version" "sort" "strconv" "strings" @@ -22,7 +23,6 @@ import ( clientpkg "github.com/hashicorp/waypoint/internal/client" "github.com/hashicorp/waypoint/internal/clierrors" "github.com/hashicorp/waypoint/internal/pkg/flag" - "github.com/hashicorp/waypoint/internal/version" pb "github.com/hashicorp/waypoint/pkg/server/gen" ) diff --git a/internal/cli/main.go b/internal/cli/main.go index e6ca3c4a31c..27fdd942a59 100644 --- a/internal/cli/main.go +++ b/internal/cli/main.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "fmt" + "github.com/hashicorp/waypoint/version" "io" "io/ioutil" "os" @@ -18,13 +19,12 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-plugin" - "github.com/mitchellh/cli" "github.com/mitchellh/go-glint" "github.com/hashicorp/waypoint-plugin-sdk/terminal" "github.com/hashicorp/waypoint/internal/env" "github.com/hashicorp/waypoint/internal/pkg/signalcontext" - "github.com/hashicorp/waypoint/internal/version" + "github.com/mitchellh/cli" ) const ( diff --git a/internal/cli/release_list.go b/internal/cli/release_list.go index df42cfe47bf..32f0e4e90ab 100644 --- a/internal/cli/release_list.go +++ b/internal/cli/release_list.go @@ -7,6 +7,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/hashicorp/waypoint/version" "sort" "strconv" "strings" @@ -21,7 +22,6 @@ import ( clientpkg "github.com/hashicorp/waypoint/internal/client" "github.com/hashicorp/waypoint/internal/clierrors" "github.com/hashicorp/waypoint/internal/pkg/flag" - "github.com/hashicorp/waypoint/internal/version" pb "github.com/hashicorp/waypoint/pkg/server/gen" ) diff --git a/internal/cli/status.go b/internal/cli/status.go index ad401ef4779..e2561266c73 100644 --- a/internal/cli/status.go +++ b/internal/cli/status.go @@ -7,6 +7,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/hashicorp/waypoint/version" "strings" "github.com/dustin/go-humanize" @@ -20,7 +21,6 @@ import ( clientpkg "github.com/hashicorp/waypoint/internal/client" "github.com/hashicorp/waypoint/internal/clierrors" "github.com/hashicorp/waypoint/internal/pkg/flag" - "github.com/hashicorp/waypoint/internal/version" pb "github.com/hashicorp/waypoint/pkg/server/gen" ) diff --git a/internal/cli/version.go b/internal/cli/version.go index 63a74b6ce7d..44e47ee6082 100644 --- a/internal/cli/version.go +++ b/internal/cli/version.go @@ -6,12 +6,12 @@ package cli import ( "context" "errors" + "github.com/hashicorp/waypoint/version" "time" "github.com/posener/complete" "github.com/hashicorp/waypoint/internal/pkg/flag" - "github.com/hashicorp/waypoint/internal/version" "github.com/hashicorp/waypoint/pkg/serverclient" ) diff --git a/pkg/protocolversion/current.go b/pkg/protocolversion/current.go index 8e59bbb1b88..6bba8d0b7ac 100644 --- a/pkg/protocolversion/current.go +++ b/pkg/protocolversion/current.go @@ -4,8 +4,8 @@ package protocolversion import ( - "github.com/hashicorp/waypoint/internal/version" pb "github.com/hashicorp/waypoint/pkg/server/gen" + "github.com/hashicorp/waypoint/version" ) // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/version/VERSION b/version/VERSION index d33c3a2128b..ac454c6a1fc 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -0.12.0 \ No newline at end of file +0.12.0 diff --git a/internal/version/version.go b/version/version.go similarity index 82% rename from internal/version/version.go rename to version/version.go index 33e685081a4..dd564f0d1b9 100644 --- a/internal/version/version.go +++ b/version/version.go @@ -5,7 +5,9 @@ package version import ( "bytes" + _ "embed" "fmt" + "strings" ) var ( @@ -13,9 +15,12 @@ var ( GitCommit string GitDescribe string - Version = "0.12.0" // Note: This value should match /version/VERSION! - VersionPrerelease = "" - VersionMetadata = "" + // Version and VersionPrerelease info are now being embedded directly from the VERSION file. + // VersionMetadata is being passed in via ldflags in CI, otherwise the default set here is used. + //go:embed VERSION + fullVersion string + Version, VersionPrerelease, _ = strings.Cut(strings.TrimSpace(fullVersion), "-") + VersionMetadata = "" ) // VersionInfo