Port over changes (#3061) (#3062)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2023-03-07 16:29:34 -05:00
1 parent 4819d17ee8
commit b2bab45c13
20 files changed
+145 -105

No files matched your search

+13 -3
View File
@@ -28,6 +28,15 @@ echo "==> Build tags: ${BUILD_TAGS}"
GIT_COMMIT="$(git rev-parse HEAD)"
GIT_DIRTY="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)"
# Get the build date from the latest commit since it can be used across all
# builds
function build_date() {
# It's tricky to do an RFC3339 format in a cross platform way, so we hardcode UTC
: "${DATE_FORMAT:="%Y-%m-%dT%H:%M:%SZ"}"
git show --no-show-signature -s --format=%cd --date=format:"$DATE_FORMAT" HEAD
}
BUILD_DATE=$(build_date)
# If not explicitly cross-compiling, build for the current platform
if [ "${GOOS}x" == "x" ]; then
GOOS=$(go env GOOS)
@@ -57,7 +66,7 @@ if [ "${CI_BUILD}x" != "x" ]; then
exit
fi
PRODUCT_VERSION=${PRODUCT_VERSION:=$(cat version/VERSION)}
BASE_PRODUCT_VERSION=${BASE_PRODUCT_VERSION:=$(cat version/VERSION)}
# Declare binary paths!
BINARY_NAME="boundary${BINARY_SUFFIX}"
@@ -77,10 +86,11 @@ ${GO_CMD} build \
-trimpath \
-buildvcs=false \
-ldflags "
-X github.com/hashicorp/boundary/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY}
-X 'github.com/hashicorp/boundary/version.Version=$PRODUCT_VERSION'
-X 'github.com/hashicorp/boundary/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY}'
-X 'github.com/hashicorp/boundary/version.Version=$BASE_PRODUCT_VERSION'
-X 'github.com/hashicorp/boundary/version.VersionPrerelease=$PRERELEASE_PRODUCT_VERSION'
-X 'github.com/hashicorp/boundary/version.VersionMetadata=$METADATA_PRODUCT_VERSION'
-X 'github.com/hashicorp/boundary/version.BuildDate=$BUILD_DATE'
" \
-o "$BIN_PATH" \
./cmd/boundary