Commit 4afc509c by Chavee Issariyapat

update Makefile to 1.1.9

parent 780234bb
# a helper shell script
MAKE_VERSION=1.1.8
MAKE_VERSION=1.1.9
define MAKEFUNCTIONCODE
function hasChanges() {
......@@ -10,7 +10,19 @@ define MAKEFUNCTIONCODE
}
function getRelease() {
awk -F= '/^RELEASE=/{print $$2}' release.conf
# old : use tag in release.conf
# awk -F= '/^RELEASE=/{print $$2}' release.conf
# new use tag from git of the form -> 1.0.1-2-3b10c420
TAGN=$$(git describe | sed -e "s/-g.*//g")
T1=$$(echo $$TAGN | sed -e "s/-.*//")
T2=$$(echo $$TAGN | sed -e "s/^[^\-]*//")
if [$$T2 == ""]
then
T2="-0"
fi
echo $$T1$$T2
}
function getBaseTag() {
......@@ -63,7 +75,11 @@ define MAKEFUNCTIONCODE
result=$$(getRelease)
if differsFromRelease; then
result="$$result-$$(git log -n 1 --format=%h .)"
# output only first 7 characters
# result="$$result-$$(git log -n 1 --format=%h .)"
# output first 8 characters
result="$$result-$$(git log -n 1 --format=%H . | head -c 8)"
fi
if hasChanges ; then
......@@ -179,7 +195,7 @@ do-push:
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest
snapshot: build push
build-push: build push
show-tag: init release.conf
@. $(RELEASE_SUPPORT); getVersion
......@@ -189,35 +205,40 @@ showtag: init release.conf
@. $(RELEASE_SUPPORT); getVersion
@rm .make-function
tag-patch-release: init
VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel)
tag-patch-release: release.conf tag
# tag-patch-release: init
# VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel)
# tag-patch-release: release.conf tag
# tag-minor-release: init
# VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel)
# tag-minor-release: release.conf tag
tag-minor-release: init
VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel)
tag-minor-release: release.conf tag
# tag-major-release: init
# VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
# tag-major-release: release.conf tag
tag-major-release: init
VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
tag-major-release: release.conf tag
# patch-release: tag-patch-release release
# @echo $(VERSION)
patch-release: tag-patch-release release
@echo $(VERSION)
# minor-release: tag-minor-release release
# @echo $(VERSION)
minor-release: tag-minor-release release
@echo $(VERSION)
# major-release: tag-major-release release
# @echo $(VERSION)
major-release: tag-major-release release
@echo $(VERSION)
# tag:
# @echo "$$MAKEFUNCTIONCODE" > ./.make-function
# TAG=$(shell . $(RELEASE_SUPPORT); getTag $(VERSION))
tag: TAG=$(shell . $(RELEASE_SUPPORT); getTag $(VERSION))
tag: check-status
@. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; setRelease $(VERSION)
git add .
git commit -m "bumped to version $(VERSION)" ;
git tag $(TAG) ;
@ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
# tag: check-status
# @echo "$$MAKEFUNCTIONCODE" > ./.make-function
# @. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ;
# @. $(RELEASE_SUPPORT) ; setRelease $(VERSION)
# git add .
# git commit -m "bumped to version $(VERSION)" ;
# git tag $(TAG) ;
# @ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
# @rm .make-function
check-status: init
@. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2) ;
......@@ -253,3 +274,4 @@ env-snippet:
deploy: init release.conf
@ cat k8s/deployment.yaml | sed "s/{{IMAGE_TAG}}/$(VERSION)/g" | kubectl apply -f - $(DEPLOYARG)
@rm .make-function
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