forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
versioning.mk
28 lines (23 loc) · 902 Bytes
/
versioning.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
MUTABLE_VERSION := canary
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_SHA = $(shell git rev-parse --short HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
BUILD = $(shell date +%FT%T%z)
ifdef VERSION
DOCKER_VERSION = $(VERSION)
BINARY_VERSION = $(VERSION)
endif
DOCKER_VERSION ?= git-${GIT_SHA}
BINARY_VERSION ?= ${GIT_TAG}
# Only set Version if building a tag or VERSION is set
ifneq ($(BINARY_VERSION),)
LDFLAGS += -X github.com/Azure/acs-engine/cmd.BuildSHA=${VERSION}
LDFLAGS += -X github.com/Azure/acs-engine/cmd.BuildTime=${BUILD}
endif
info:
@echo "Version: ${VERSION}"
@echo "Git Tag: ${GIT_TAG}"
@echo "Git Commit: ${GIT_COMMIT}"
@echo "Git Tree State: ${GIT_DIRTY}"
@echo "Docker Version: ${DOCKER_VERSION}"