mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Fix for main: Add vault revision to --version cmd (#13428)
This commit is contained in:
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -23,6 +23,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make version
|
make version
|
||||||
echo "::set-output name=product-version::$(make version)"
|
echo "::set-output name=product-version::$(make version)"
|
||||||
|
|
||||||
generate-metadata-file:
|
generate-metadata-file:
|
||||||
needs: get-product-version
|
needs: get-product-version
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -88,7 +89,7 @@ jobs:
|
|||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
run: |
|
run: |
|
||||||
mkdir dist out
|
mkdir dist out
|
||||||
VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_COMMIT=${GITHUB_SHA} GO_TAGS="${{ env.GO_TAGS }}" make build
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
|
||||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
@@ -134,7 +135,7 @@ jobs:
|
|||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
run: |
|
run: |
|
||||||
mkdir dist out
|
mkdir dist out
|
||||||
VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_COMMIT=${GITHUB_SHA} GO_TAGS="${{ env.GO_TAGS }}" make build
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
|
||||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
@@ -209,7 +210,7 @@ jobs:
|
|||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
run: |
|
run: |
|
||||||
mkdir dist out
|
mkdir dist out
|
||||||
VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_COMMIT=${GITHUB_SHA} GO_TAGS="${{ env.GO_TAGS }}" make build
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
|
||||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ project "vault" {
|
|||||||
"release/1.6.x",
|
"release/1.6.x",
|
||||||
"release/1.7.x",
|
"release/1.7.x",
|
||||||
"release/1.8.x",
|
"release/1.8.x",
|
||||||
"release/1.9.x"
|
"release/1.9.x",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -259,7 +259,7 @@ ci-verify:
|
|||||||
# This is used for release builds by .github/workflows/build.yml
|
# This is used for release builds by .github/workflows/build.yml
|
||||||
build:
|
build:
|
||||||
@echo "--> Building Vault $(VAULT_VERSION)"
|
@echo "--> Building Vault $(VAULT_VERSION)"
|
||||||
@go build -v -tags "$(GO_TAGS)" -ldflags " -X $VERSION_PKG_PATH.Version=$(VAULT_VERSION) -X $VERSION_PKG_PATH.GitCommit=$(VAULT_COMMIT)" -o dist/
|
@go build -v -tags "$(GO_TAGS)" -ldflags " -X github.com/hashicorp/vault/sdk/version.Version=$(VAULT_VERSION) -X github.com/hashicorp/vault/sdk/version.GitCommit=$(VAULT_REVISION)" -o dist/
|
||||||
|
|
||||||
.PHONY: version
|
.PHONY: version
|
||||||
# This is used for release builds by .github/workflows/build.yml
|
# This is used for release builds by .github/workflows/build.yml
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
|
|
||||||
// VersionInfo
|
// VersionInfo
|
||||||
type VersionInfo struct {
|
type VersionInfo struct {
|
||||||
Revision string
|
Revision string `json:"revision,omitempty"`
|
||||||
Version string
|
Version string `json:"version,omitempty"`
|
||||||
VersionPrerelease string
|
VersionPrerelease string `json:"version_prerelease,omitempty"`
|
||||||
VersionMetadata string
|
VersionMetadata string `json:"version_metadata,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVersion() *VersionInfo {
|
func GetVersion() *VersionInfo {
|
||||||
@@ -37,7 +37,7 @@ func (c *VersionInfo) VersionNumber() string {
|
|||||||
return "(version unknown)"
|
return "(version unknown)"
|
||||||
}
|
}
|
||||||
|
|
||||||
version := fmt.Sprintf("%s", c.Version)
|
version := c.Version
|
||||||
|
|
||||||
if c.VersionPrerelease != "" {
|
if c.VersionPrerelease != "" {
|
||||||
version = fmt.Sprintf("%s-%s", version, c.VersionPrerelease)
|
version = fmt.Sprintf("%s-%s", version, c.VersionPrerelease)
|
||||||
|
|||||||
Reference in New Issue
Block a user