@ -1,9 +1,9 @@
MUTABLE_VERSION ? = canary
MUTABLE_VERSION : = canary
GIT_COMMIT ? = $( shell git rev-parse HEAD)
GIT_COMMIT = $( shell git rev-parse HEAD)
GIT_SHA ? = $( shell git rev-parse --short HEAD)
GIT_SHA = $( shell git rev-parse --short HEAD)
GIT_TAG ? = $( shell git describe --tags --abbrev= 0 2>/dev/null)
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" )
GIT_DIRTY = $( shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean" )
i f d e f V E R S I O N
i f d e f V E R S I O N
DOCKER_VERSION = $( VERSION)
DOCKER_VERSION = $( VERSION)
@ -11,25 +11,38 @@ ifdef VERSION
e n d i f
e n d i f
DOCKER_VERSION ?= git-${ GIT_SHA }
DOCKER_VERSION ?= git-${ GIT_SHA }
BINARY_VERSION ?= ${ GIT_TAG } -${ GIT_SHA }
BINARY_VERSION ?= ${ GIT_TAG }
IMAGE := ${ DOCKER_REGISTRY } /${ IMAGE_PREFIX } /${ SHORT_NAME } :${ DOCKER_VERSION }
# Only set Version if building a tag or VERSION is set
MUTABLE_IMAGE := ${ DOCKER_REGISTRY } /${ IMAGE_PREFIX } /${ SHORT_NAME } :${ MUTABLE_VERSION }
i f n e q ( $( BINARY_VERSION ) , )
LDFLAGS += -X k8s.io/helm/pkg/version.Version= ${ BINARY_VERSION }
e n d i f
# Clear the "unreleased" string in BuildMetadata
i f n e q ( $( GIT_TAG ) , )
LDFLAGS += -X k8s.io/helm/pkg/version.BuildMetadata=
e n d i f
LDFLAGS += -X k8s.io/helm/pkg/version.Version= ${ GIT_TAG }
LDFLAGS += -X k8s.io/helm/pkg/version.GitCommit= ${ GIT_COMMIT }
LDFLAGS += -X k8s.io/helm/pkg/version.GitCommit= ${ GIT_COMMIT }
LDFLAGS += -X k8s.io/helm/pkg/version.GitTreeState= ${ GIT_DIRTY }
LDFLAGS += -X k8s.io/helm/pkg/version.GitTreeState= ${ GIT_DIRTY }
IMAGE := ${ DOCKER_REGISTRY } /${ IMAGE_PREFIX } /${ SHORT_NAME } :${ DOCKER_VERSION }
MUTABLE_IMAGE := ${ DOCKER_REGISTRY } /${ IMAGE_PREFIX } /${ SHORT_NAME } :${ MUTABLE_VERSION }
DOCKER_PUSH = docker push
DOCKER_PUSH = docker push
i f e q ( $( DOCKER_REGISTRY ) , g c r . i o )
i f e q ( $( DOCKER_REGISTRY ) , g c r . i o )
DOCKER_PUSH = gcloud docker push
DOCKER_PUSH = gcloud docker push
e n d i f
e n d i f
info :
info :
@echo " Build tag: ${ DOCKER_VERSION } "
@echo " Version: ${ VERSION } "
@echo " Registry: ${ DOCKER_REGISTRY } "
@echo " Git Tag: ${ GIT_TAG } "
@echo " Immutable tag: ${ IMAGE } "
@echo " Git Commit: ${ GIT_COMMIT } "
@echo " Mutable tag: ${ MUTABLE_IMAGE } "
@echo " Git Tree State: ${ GIT_DIRTY } "
@echo " Docker Version: ${ DOCKER_VERSION } "
@echo " Registry: ${ DOCKER_REGISTRY } "
@echo " Immutable Image: ${ IMAGE } "
@echo " Mutable Image: ${ MUTABLE_IMAGE } "
.PHONY : docker -push
.PHONY : docker -push
docker-push : docker -mutable -push docker -immutable -push
docker-push : docker -mutable -push docker -immutable -push