This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Makefile.common
64 lines (49 loc) · 1.67 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
TOPDIR=$(dir $(lastword $(MAKEFILE_LIST)))
include $(TOPDIR)/Makefile.env.mk
NAMESPACE ?= $(shell oc project -q)
MOCHA_FILE ?= build/test-results/test/TEST-$(PROJECT_NAME).xml
SKIP_TESTS ?= false
MAVEN_BATCH ?= true
UNAME_S := $(shell uname -s)
LN=ln
BUILD_GOOS=linux
BUILD_GOARCH=amd64
ifeq ($(UNAME_S),Darwin)
LN = gln
endif
ifeq ($(MAVEN_BATCH),true)
MAVEN_ARGS+=-B
endif
all: init build test package
init:
mkdir -p build
clean_node:
rm -rf node_modules coverage
clean: clean_node
rm -rf build
buildpush:
$(MAKE)
$(MAKE) docker_build
$(MAKE) docker_tag
$(MAKE) docker_push
docker_build: package image_deps
if [ -f Dockerfile ]; then $(DOCKER) build $(DOCKER_BUILD_ARGS) --build-arg maven_version=$(MAVEN_VERSION) --build-arg version=$(VERSION) --build-arg revision=$(REVISION) -t $(PROJECT_PREFIX)-$(PROJECT_NAME):$(VERSION) . ; fi
if [ -f Dockerfile ]; then $(DOCKER) images | grep $(PROJECT_PREFIX); fi
docker_tag:
if [ -f Dockerfile ]; then $(DOCKER) tag $(PROJECT_PREFIX)-$(PROJECT_NAME):$(VERSION) $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(PROJECT_NAME):$(TAG) ; fi
if [ -f Dockerfile ]; then $(DOCKER) images | grep $(PROJECT_PREFIX); fi
docker_push:
if [ -f Dockerfile ] ; \
then \
bash $(TOPDIR)/scripts/docker_push.sh "$(DOCKER) push $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(PROJECT_NAME):$(TAG)" 10 10 ; \
fi
kind_load_image:
if [ -f Dockerfile ]; \
then \
kind load docker-image $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(PROJECT_NAME):$(TAG) ; \
fi
buildpushkind: all docker_build docker_tag kind_load_image
:
image_deps::
:
.PHONY: all init build test package clean docker_build docker_tag docker_push kind_load_image buildpushkind buildpush image_deps