Commit 4afc509c by Chavee Issariyapat

update Makefile to 1.1.9

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