forked from apache/incubator-kie-kogito-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (155 loc) · 7.74 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
IMAGE_VERSION := $(shell cat image.yaml | egrep ^version | cut -d"\"" -f2)
SHORTENED_LATEST_VERSION := $(shell echo $(IMAGE_VERSION) | awk -F. '{print $$1"."$$2}')
BUILD_ENGINE := docker
.DEFAULT_GOAL := build
CEKIT_CMD := cekit -v ${cekit_option}
# Build all images
.PHONY: build
# start to build the images
build: clone-repos kogito-quarkus-ubi8 kogito-quarkus-jvm-ubi8 kogito-quarkus-ubi8-s2i kogito-springboot-ubi8 kogito-springboot-ubi8-s2i kogito-data-index kogito-jobs-service kogito-management-console
clone-repos:
# if the NO_TEST env defined, proceed with the tests, as first step prepare the repo to be used
ifneq ($(ignore_test),true)
cd tests/test-apps && sh clone-repo.sh
endif
# build the quay.io/kiegroup/kogito-quarkus-ubi8 image
kogito-quarkus-ubi8:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-quarkus-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-quarkus-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)),rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-ubi8:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-quarkus-jvm-ubi8 image
kogito-quarkus-jvm-ubi8:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-quarkus-jvm-overrides.yaml ${BUILD_ENGINE}
endif
# if no NO_TEST env defined, test the image
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-quarkus-jvm-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)),rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-quarkus-ubi8-s2i image
kogito-quarkus-ubi8-s2i:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-quarkus-s2i-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-quarkus-s2i-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)),rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-springboot-ubi8 image
kogito-springboot-ubi8:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-springboot-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-springboot-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)),rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-springboot-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-springboot-ubi8:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-springboot-ubi8-s2i image
kogito-springboot-ubi8-s2i:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-springboot-s2i-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-springboot-s2i-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)), rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-springboot-ubi8-s2i:${IMAGE_VERSION} quay.io/kiegroup/kogito-springboot-ubi8-s2i:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-data-index image
kogito-data-index:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-data-index-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-data-index-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)), rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-data-index:${IMAGE_VERSION} quay.io/kiegroup/kogito-data-index:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-jobs-service image
kogito-jobs-service:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-jobs-service-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-jobs-service-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)), rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-jobs-service:${IMAGE_VERSION} quay.io/kiegroup/kogito-jobs-service:${SHORTENED_LATEST_VERSION}
endif
# build the quay.io/kiegroup/kogito-management-console image
kogito-management-console:
ifneq ($(ignore_build),true)
${CEKIT_CMD} build --overrides-file kogito-management-console-overrides.yaml ${BUILD_ENGINE}
endif
# if ignore_test is set tu true, ignore the tests
ifneq ($(ignore_test),true)
${CEKIT_CMD} test --overrides-file kogito-management-console-overrides.yaml behave
endif
ifneq ($(findstring rc,$(IMAGE_VERSION)), rc)
${BUILD_ENGINE} tag quay.io/kiegroup/kogito-management-console:${IMAGE_VERSION} quay.io/kiegroup/kogito-management-console:${SHORTENED_LATEST_VERSION}
endif
# push images to quay.io, this requires permissions under kiegroup organization
.PHONY: push
push: build _push
_push:
docker push quay.io/kiegroup/kogito-quarkus-ubi8:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-ubi8:latest
docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:latest
docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:latest
docker push quay.io/kiegroup/kogito-springboot-ubi8:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8:latest
docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:latest
docker push quay.io/kiegroup/kogito-data-index:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-data-index:latest
docker push quay.io/kiegroup/kogito-jobs-service:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-jobs-service:latest
docker push quay.io/kiegroup/kogito-management-console:${IMAGE_VERSION}
docker push quay.io/kiegroup/kogito-management-console:latest
ifneq ($(findstring rc,$(IMAGE_VERSION)), rc)
@echo "${SHORTENED_LATEST_VERSION} will be pushed"
docker push quay.io/kiegroup/kogito-quarkus-ubi8:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-data-index:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-jobs-service:${SHORTENED_LATEST_VERSION}
docker push quay.io/kiegroup/kogito-management-console:${SHORTENED_LATEST_VERSION}
endif
# push staging images to quay.io, done before release, this requires permissions under kiegroup organization
.PHONY: push-staging
push-staging: build _push-staging
_push-staging:
python3 scripts/push-staging.py
# push to local registry, useful to push the built images to local registry
# requires parameter: REGISTRY: my-custom-registry:[port]
# requires pre built images, if no images, run make build first
# the shortened version will be used so operator can fetch it from the local namespace.
# use the NS env to set the current namespace, if no set openshift will be used
# example: make push-local-registry REGISTRY=docker-registry-default.apps.spolti.cloud NS=spolti-1
.PHONY: push-local-registry
push-local-registry:
/bin/sh scripts/push-local-registry.sh ${REGISTRY} ${SHORTENED_LATEST_VERSION} ${NS}