Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docker-makefile-sample
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sample
docker-makefile-sample
Commits
4afc509c
Commit
4afc509c
authored
Mar 04, 2020
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Makefile to 1.1.9
parent
780234bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
27 deletions
+49
-27
Makefile
+49
-27
No files found.
Makefile
View file @
4afc509c
# 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-min
or-release
:
init
VERSION :
=
$(
shell
.
$(RELEASE_SUPPORT)
;
nextMin
orLevel
)
tag-min
or-release
:
release.conf tag
# tag-maj
or-release: init
# VERSION := $(shell . $(RELEASE_SUPPORT); nextMaj
orLevel)
# tag-maj
or-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-min
or-release release
@
echo
$(VERSION)
# major-release: tag-maj
or-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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment