2019-08-02 19:15:59 +00:00
|
|
|
#!/bin/bash
|
2023-03-22 13:17:19 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-08-02 19:15:59 +00:00
|
|
|
|
|
|
|
export GIT_COMMIT=$(git rev-parse --short HEAD)
|
2020-01-24 15:40:14 +00:00
|
|
|
export GIT_COMMIT_YEAR=$(git show -s --format=%cd --date=format:%Y HEAD)
|
2019-08-02 19:15:59 +00:00
|
|
|
export GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
|
|
|
export GIT_IMPORT=github.com/hashicorp/consul/version
|
2022-06-11 03:22:43 +00:00
|
|
|
# we're using this for build date because it's stable across platform builds
|
|
|
|
# the env -i and -noprofile are used to ensure we don't try to recursively call this profile when starting bash
|
2022-10-24 15:19:31 +00:00
|
|
|
export GIT_DATE=$(env -i /bin/bash --noprofile -norc /home/circleci/project/build-support/scripts/build-date.sh)
|
2022-06-11 03:22:43 +00:00
|
|
|
export GOLDFLAGS="-X ${GIT_IMPORT}.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X ${GIT_IMPORT}.BuildDate=${GIT_DATE}"
|