From 5bc6e492041ba1c3c936a749b518780c84bdfd4d Mon Sep 17 00:00:00 2001 From: Josh Burman Date: Fri, 21 Feb 2020 16:46:47 -0500 Subject: [PATCH] update makefile --- Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 1880968..cb2e422 100644 --- a/Makefile +++ b/Makefile @@ -5,24 +5,27 @@ help: repo=yardstick project=braid -tag=$(shell git rev-parse --short=7 HEAD) branch=$(shell git rev-parse --abbrev-ref HEAD) -version=$(shell git describe --exact-match --tags $(git log -n1 --pretty='%h')) - - -full: build push ## build the docker container completely +tag=$(shell echo $(branch) | grep -Eo 'feature/([A-Za-z]+-[0-9]*)' | grep -Eo '[A-Za-z]+-[0-9]*' || \ + echo $(branch) | grep -Eo '(release|hotfix)/[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' | grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' || \ + echo $(branch) | grep -Eo 'YASDEV-([[:digit:]]*)') +full: build push build: ## build the production dockerfile - docker build -t $(repo)/$(project):$(tag) \ - -t $(repo)/$(project):$(branch) \ - . - if git describe --exact-match --tags $(shell git log -n1 --pretty='%h'); then \ - docker tag $(repo)/$(project):$(tag) $(repo)/$(project):$(version); \ - fi + @if [[ -n "$(tag)" ]]; then \ + echo "$(tag)" > docker_tag.txt; \ + docker build -t $(repo)/$(project):$(tag) .; \ + else \ + echo "Nothing to build."; \ + fi push: ## push the production dockerfile - docker push $(repo)/$(project):$(tag) - docker push $(repo)/$(project):$(branch) - if git describe --exact-match --tags $(shell git log -n1 --pretty='%h'); then \ - docker push $(repo)/$(project):$(version); \ - fi \ No newline at end of file + @if [[ -n "$(tag)" ]]; then \ + docker push $(repo)/$(project):$(tag); \ + else \ + echo "Nothing to push."; \ + fi + +display: ## display the tag/branch values for development testing + @echo "branch: $(branch)" + @echo "tag: $(tag)" \ No newline at end of file