Commit 580f262f by Chavee Issariyapat

do 3 tags after build

parent 68ffdc67
......@@ -74,6 +74,15 @@ define MAKEFUNCTIONCODE
function getVersion() {
result=$$(getRelease)
if hasChanges ; then
result="$$result-dirty"
fi
echo $$result
}
function getVersionWithHash() {
result=$$(getRelease)
if differsFromRelease; then
# output only first 7 characters
# result="$$result-$$(git log -n 1 --format=%h .)"
......@@ -117,6 +126,7 @@ SHELL=/bin/bash
include release.conf
IMAGE=$(REGISTRY_HOST)/$(GROUPNAME)/$(PROJECTNAME)
VERSION=$(shell . $(RELEASE_SUPPORT) ; getVersion)
VERSIONHASH=$(shell . $(RELEASE_SUPPORT) ; getVersionWithHash)
TAG=$(shell . $(RELEASE_SUPPORT); getTag)
PROJECTPATH?=.
......@@ -172,15 +182,19 @@ post-init:
@rm .make-function
docker-build:
docker build -t $(IMAGE):$(VERSION) $(PROJECTPATH)
docker build -t $(IMAGE):$(VERSIONHASH) $(PROJECTPATH)
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \
if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \
echo docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
echo docker tag -f $(IMAGE):$(VERSIONHASH) $(IMAGE):latest ;\
docker tag -f $(IMAGE):$(VERSIONHASH) $(IMAGE):latest ;\
echo docker tag -f $(IMAGE):$(VERSIONHASH) $(IMAGE):$(VERSION) ;\
docker tag -f $(IMAGE):$(VERSIONHASH) $(IMAGE):$(VERSION) ;\
else \
echo docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \
echo docker tag $(IMAGE):$(VERSIONHASH) $(IMAGE):latest ;\
docker tag $(IMAGE):$(VERSIONHASH) $(IMAGE):latest ; \
echo docker tag $(IMAGE):$(VERSIONHASH) $(IMAGE):$(VERSION) ;\
docker tag $(IMAGE):$(VERSIONHASH) $(IMAGE):$(VERSION) ;\
fi
release: check-status check-release build push
......@@ -192,17 +206,18 @@ rmi: delete-docker-image
images: list-docker-image
do-push:
docker push $(IMAGE):$(VERSIONHASH)
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest
build-push: build push
show-tag: init release.conf
@. $(RELEASE_SUPPORT); getVersion
@. $(RELEASE_SUPPORT); getVersionWithHash
@rm .make-function
showtag: init release.conf
@. $(RELEASE_SUPPORT); getVersion
@. $(RELEASE_SUPPORT); getVersionWithHash
@rm .make-function
# tag-patch-release: init
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment