Pass the git commits year through as an env var to the ui build (#7126)
This commit is contained in:
parent
1c4937d507
commit
cdacfcaa6d
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
export GIT_COMMIT=$(git rev-parse --short HEAD)
|
||||
export GIT_COMMIT_YEAR=$(git show -s --format=%cd --date=format:%Y HEAD)
|
||||
export GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
||||
export GIT_DESCRIBE=$(git describe --tags --always --match "v*")
|
||||
export GIT_IMPORT=github.com/hashicorp/consul/version
|
||||
|
|
|
@ -25,6 +25,7 @@ MAIN_GOPATH=$(shell go env GOPATH | cut -d: -f1)
|
|||
ASSETFS_PATH?=agent/bindata_assetfs.go
|
||||
# Get the git commit
|
||||
GIT_COMMIT?=$(shell git rev-parse --short HEAD)
|
||||
GIT_COMMIT_YEAR?=$(shell git show -s --format=%cd --date=format:%Y HEAD)
|
||||
GIT_DIRTY?=$(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
||||
GIT_DESCRIBE?=$(shell git describe --tags --always --match "v*")
|
||||
GIT_IMPORT=github.com/hashicorp/consul/version
|
||||
|
@ -127,6 +128,7 @@ export GO_BUILD_TAG
|
|||
export UI_BUILD_TAG
|
||||
export BUILD_CONTAINER_NAME
|
||||
export GIT_COMMIT
|
||||
export GIT_COMMIT_YEAR
|
||||
export GIT_DIRTY
|
||||
export GIT_DESCRIBE
|
||||
export GOTAGS
|
||||
|
@ -284,6 +286,7 @@ test-docker: linux go-build-image
|
|||
-e 'GOTEST_PKGS=$(GOTEST_PKGS)' \
|
||||
-e 'GOTAGS=$(GOTAGS)' \
|
||||
-e 'GIT_COMMIT=$(GIT_COMMIT)' \
|
||||
-e 'GIT_COMMIT_YEAR=$(GIT_COMMIT_YEAR)' \
|
||||
-e 'GIT_DIRTY=$(GIT_DIRTY)' \
|
||||
-e 'GIT_DESCRIBE=$(GIT_DESCRIBE)' \
|
||||
$(TEST_PARALLELIZATION) \
|
||||
|
|
|
@ -34,6 +34,7 @@ function build_ui {
|
|||
#
|
||||
# Notes:
|
||||
# Use the GIT_COMMIT environment variable to pass off to the build
|
||||
# Use the GIT_COMMIT_YEAR environment variable to pass off to the build
|
||||
|
||||
if ! test -d "$1"
|
||||
then
|
||||
|
@ -63,6 +64,13 @@ function build_ui {
|
|||
then
|
||||
commit_hash=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
local commit_year="${GIT_COMMIT_YEAR}"
|
||||
if test -z "${commit_year}"
|
||||
then
|
||||
commit_year=$(git show -s --format=%cd --date=format:%Y HEAD)
|
||||
fi
|
||||
|
||||
local logo_type="${CONSUL_BINARY_TYPE}"
|
||||
if test "$logo_type" != "oss"
|
||||
then
|
||||
|
@ -73,7 +81,7 @@ function build_ui {
|
|||
pushd ${ui_dir} > /dev/null
|
||||
|
||||
status "Creating the UI Build Container with image: ${image_name} and version '${version}'"
|
||||
local container_id=$(docker create -it -e "CONSUL_GIT_SHA=${commit_hash}" -e "CONSUL_VERSION=${version}" -e "CONSUL_BINARY_TYPE=${CONSUL_BINARY_TYPE}" ${image_name})
|
||||
local container_id=$(docker create -it -e "CONSUL_GIT_SHA=${commit_hash}" -e "CONSUL_COPYRIGHT_YEAR=${commit_year}" -e "CONSUL_VERSION=${version}" -e "CONSUL_BINARY_TYPE=${CONSUL_BINARY_TYPE}" ${image_name})
|
||||
local ret=$?
|
||||
if test $ret -eq 0
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue