Merge pull request #20239 from hashicorp/svh/b-build-script-v0.12

build.sh: only set git commit info for dev builds
This commit is contained in:
Sander van Harmelen 2019-02-07 09:53:15 +01:00 committed by GitHub
commit 651ee113ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -26,9 +26,12 @@ rm -rf pkg/*
mkdir -p bin/
# If its dev mode, only build for ourself
if [ "${TF_DEV}x" != "x" ]; then
if [[ -n "${TF_DEV}" ]]; then
XC_OS=$(go env GOOS)
XC_ARCH=$(go env GOARCH)
# Allow LD_FLAGS to be appended during development compilations
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} $LD_FLAGS"
fi
if ! which gox > /dev/null; then
@ -36,15 +39,12 @@ if ! which gox > /dev/null; then
go get -u github.com/mitchellh/gox
fi
# instruct gox to build statically linked binaries
# Instruct gox to build statically linked binaries
export CGO_ENABLED=0
# Allow LD_FLAGS to be appended during development compilations
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} $LD_FLAGS"
# In release mode we don't want debug information in the binary
if [[ -n "${TF_RELEASE}" ]]; then
LD_FLAGS="-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hashicorp/terraform/version.Prerelease= -s -w"
LD_FLAGS="-s -w"
fi
# Ensure all remote modules are downloaded and cached before build so that