forked from geoserver/geoserver-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
194 lines (155 loc) · 7.37 KB
/
Makefile
File metadata and controls
194 lines (155 loc) · 7.37 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
.PHONY: all
all: install test build-image
TAG?=$(shell ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
COSIGN_PASSWORD := $(COSIGN_PASSWORD)
REPACKAGE ?= true
.PHONY: clean
clean:
./mvnw clean
.PHONY: build-tools
build-tools:
./mvnw clean install -pl build-tools/
.PHONY: lint
lint: build-tools
./mvnw validate -Dqa -fae -ntp -T1C
.PHONY: lint-pom
lint-pom:
./mvnw validate -Dqa -fae -Dspotless.skip=true -Dcheckstyle.skip=true -ntp -T1C
.PHONY: lint-java
lint-java: build-tools
./mvnw validate -Dqa -fae -Dsortpom.skip=true -ntp -T1C
.PHONY: format
format: format-pom format-java
.PHONY: format-pom
format-pom:
./mvnw sortpom:sort -ntp -T1C
.PHONY: format-java
format-java:
./mvnw spotless:apply -ntp -T1C
.PHONY: install
install: build-tools
./mvnw clean install -DskipTests -ntp -U -T1C
.PHONY: package
package:
./mvnw clean package -Dfmt.skip -DskipTests -ntp -U -T1C
.PHONY: test
test:
./mvnw verify -Dfmt.skip -ntp -T1C
.PHONY: build-image
build-image: build-base-images build-image-infrastructure build-image-geoserver
.PHONY: build-base-images
build-base-images: package-base-images
TAG=$(TAG) docker compose -f docker-build/base-images.yml build jre
TAG=$(TAG) docker compose -f docker-build/base-images.yml build spring-boot
TAG=$(TAG) docker compose -f docker-build/base-images.yml build geoserver-common
.PHONY: build-image-infrastructure
build-image-infrastructure: package-infrastructure-images
TAG=$(TAG) docker compose -f docker-build/infrastructure.yml build
# This uses $(MAKECMDGOALS) (all targets specified) and filters out the target itself ($@), passing the rest as arguments. The %: rule tells make to ignore any unrecognized "targets" (which are actually your service names).
# Then you can call:
# make build-image-geoserver wcs wfs
.PHONY: build-image-geoserver
build-image-geoserver: package-geoserver-images
TAG=$(TAG) docker compose -f docker-build/geoserver.yml build $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
.PHONY: build-image-multiplatform
build-image-multiplatform: build-base-images-multiplatform build-image-infrastructure-multiplatform build-image-geoserver-multiplatform
.PHONY: build-base-images-multiplatform
build-base-images-multiplatform: package-base-images
TAG=$(TAG) docker compose -f docker-build/base-images-multiplatform.yml build jre --push \
&& TAG=$(TAG) docker compose -f docker-build/base-images-multiplatform.yml build spring-boot --push \
&& TAG=$(TAG) docker compose -f docker-build/base-images-multiplatform.yml build geoserver-common --push
.PHONY: build-image-infrastructure-multiplatform
build-image-infrastructure-multiplatform: package-infrastructure-images
TAG=$(TAG) docker compose -f docker-build/infrastructure-multiplatform.yml build --push
# This uses $(MAKECMDGOALS) (all targets specified) and filters out the target itself ($@), passing the rest as arguments. The %: rule tells make to ignore any unrecognized "targets" (which are actually your service names).
# Then you can call:
# make build-image-geoserver-multiplatform wcs wfs
.PHONY: build-image-geoserver-multiplatform
build-image-geoserver-multiplatform: package-geoserver-images
TAG=$(TAG) docker compose -f docker-build/geoserver-multiplatform.yml build --push $(filter-out $@ build-image build-image-multiplatform,$(MAKECMDGOALS))
.PHONY: package-base-images
package-base-images:
ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/base-images/jre,src/apps/base-images/spring-boot,src/apps/base-images/geoserver
else
@echo "Not re-packaging base images, assuming the target/*-bin.jar files exist"
endif
.PHONY: package-infrastructure-images
package-infrastructure-images:
ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/infrastructure/config,src/apps/infrastructure/discovery,src/apps/infrastructure/gateway
else
@echo "Not re-packaging infra images, assuming the target/*-bin.jar files exist"
endif
.PHONY: package-geoserver-images
package-geoserver-images:
ifeq ($(REPACKAGE), true)
./mvnw clean package -DskipTests -T1C -ntp -am -pl src/apps/geoserver/gwc,src/apps/geoserver/restconfig,src/apps/geoserver/wcs,src/apps/geoserver/webui,src/apps/geoserver/wfs,src/apps/geoserver/wms,src/apps/geoserver/wcs,src/apps/geoserver/wps
else
@echo "Not re-packaging geoserver images, assuming the target/*-bin.jar files exist"
endif
.PHONY: pull-images
pull-images:
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) \
docker compose \
-f docker-build/geoserver-multiplatform.yml \
-f docker-build/infrastructure-multiplatform.yml \
pull --quiet
.PHONY: sign-image
sign-image:
@bash -c '\
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
for image in $$images; do \
echo "Signing $$image"; \
output=$$(cosign sign --yes --key env://COSIGN_KEY --recursive $$image 2>&1); \
if [ $$? -ne 0 ]; then \
echo "Error occurred: $$output"; \
exit 1; \
else \
echo "Signing successful: $$output"; \
fi; \
done'
.PHONY: verify-image
verify-image:
@bash -c '\
TAG=$$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout); \
images=$$(TAG=$$TAG docker compose -f docker-build/geoserver-multiplatform.yml -f docker-build/infrastructure-multiplatform.yml config --images); \
for image in $$images; do \
echo "Verifying $$image"; \
output=$$(cosign verify --key env://COSIGN_PUB_KEY $$image 2>&1); \
if [ $$? -ne 0 ]; then \
echo "Error occurred: $$output"; \
exit 1; \
else \
echo "Verification successful: $$output"; \
fi; \
done'
.PHONY: build-acceptance
build-acceptance:
docker build --tag=geoservercloud/acceptance:latest acceptance_tests
.PHONY: acceptance-tests-datadir
acceptance-tests-datadir: build-acceptance start-acceptance-tests-datadir run-acceptance-tests-datadir
.PHONY: start-acceptance-tests-datadir
start-acceptance-tests-datadir:
(cd compose/ && TAG=$(TAG) ./acceptance_datadir up -d)
.PHONY: run-acceptance-tests-datadir
run-acceptance-tests-datadir:
(cd compose/ && ./acceptance_datadir run --rm -T acceptance bash -c 'until [ -f /tmp/healthcheck ]; do echo "Waiting for /tmp/healthcheck to be available..."; sleep 5; done && pytest . -vvv --color=yes')
.PHONY: clean-acceptance-tests-datadir
clean-acceptance-tests-datadir:
(cd compose/ && TAG=$(TAG) ./acceptance_datadir down -v --remove-orphans)
.PHONY: acceptance-tests-pgconfig
acceptance-tests-pgconfig: build-acceptance start-acceptance-tests-pgconfig run-acceptance-tests-pgconfig
.PHONY: start-acceptance-tests-pgconfig
start-acceptance-tests-pgconfig:
(cd compose/ && TAG=$(TAG) ./acceptance_pgconfig up -d)
.PHONY: run-acceptance-tests-pgconfig
run-acceptance-tests-pgconfig:
(cd compose/ && ./acceptance_pgconfig run --rm -T acceptance bash -c 'until [ -f /tmp/healthcheck ]; do echo "Waiting for /tmp/healthcheck to be available..."; sleep 5; done && pytest . -vvv --color=yes --ignore=tests/test_imagemosaic.py --ignore=tests/test_imagemosaic_cog.py')
.PHONY: clean-acceptance-tests-pgconfig
clean-acceptance-tests-pgconfig:
(cd compose/ && TAG=$(TAG) ./acceptance_pgconfig down -v --remove-orphans)
# Prevent make from treating service names as targets when using $(MAKECMDGOALS) in build-image-geoserver/build-image-geoserver-multiplatform
%:
@: