-
Notifications
You must be signed in to change notification settings - Fork 79
/
Makefile
186 lines (150 loc) · 6.62 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.PHONY: all
all: install test build-image
TAG=$(shell mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
COSIGN_PASSWORD := $(COSIGN_PASSWORD)
REPACKAGE ?= true
.PHONY: clean
clean:
./mvnw clean
.PHONY: lint
lint:
./mvnw fmt:check sortpom:verify -Dsort.verifyFailOn=strict -Dsort.verifyFail=stop -ntp -T1C
.PHONY: format
format:
./mvnw sortpom:sort fmt:format -ntp -T1C
.PHONY: install
install:
./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
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/base-images.yml build jre \
&& COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/base-images.yml build spring-boot \
&& COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/base-images.yml build geoserver-common
.PHONY: build-image-infrastructure
build-image-infrastructure: package-infrastructure-images
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/infrastructure.yml build
.PHONY: build-image-geoserver
build-image-geoserver: package-geoserver-images
COMPOSE_DOCKER_CLI_BUILD=0 DOCKER_BUILDKIT=0 TAG=$(TAG) \
docker compose -f docker-build/geoserver.yml build
.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
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \
docker compose -f docker-build/base-images-multiplatform.yml build jre --push \
&& COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \
docker compose -f docker-build/base-images-multiplatform.yml build spring-boot --push \
&& COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 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
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
TAG=$(TAG) \
docker compose -f docker-build/infrastructure-multiplatform.yml build --push
.PHONY: build-image-geoserver-multiplatform
build-image-geoserver-multiplatform: package-geoserver-images
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 TAG=$(TAG) \
docker compose -f docker-build/geoserver-multiplatform.yml build --push
.PHONY: package-base-images
package-base-images:
ifeq ($(REPACKAGE), true)
./mvnw clean package -f src/apps/base-images -DskipTests -T4
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 -f src/apps/infrastructure -DskipTests -T4
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 -f src/apps/geoserver -DskipTests -T4
else
@echo "Not re-packaging geoserver images, assuming the target/*-bin.jar files exist"
endif
.PHONY: sign-image
sign-image:
@bash -c '\
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \
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 '\
images=$$(docker images --format "{{.Repository}}@{{.Digest}}" | grep "geoserver-cloud-"); \
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=acceptance:$(TAG) 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/ && ./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/ && ./acceptance_datadir down -v)
rm -rf compose/catalog-datadir/*
touch compose/catalog-datadir/.keep
.PHONY: acceptance-tests-pgconfig
acceptance-tests-pgconfig: build-acceptance start-acceptance-tests-pgconfig run-acceptance-tests-pgconfig
(cd compose/ && ./acceptance_pgconfig up -d)
(cd compose/ && ./acceptance_pgconfig exec -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: start-acceptance-tests-pgconfig
start-acceptance-tests-pgconfig:
(cd compose/ && ./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')
.PHONY: clean-acceptance-tests-pgconfig
clean-acceptance-tests-pgconfig:
(cd compose/ && ./acceptance_pgconfig down -v)
.PHONY: acceptance-tests-jdbcconfig
acceptance-tests-jdbcconfig: build-acceptance start-acceptance-tests-jdbcconfig run-acceptance-tests-jdbcconfig
.PHONY: start-acceptance-tests-jdbcconfig
start-acceptance-tests-jdbcconfig:
(cd compose/ && ./acceptance_jdbcconfig up -d)
.PHONY: run-acceptance-tests-jdbcconfig
run-acceptance-tests-jdbcconfig:
(cd compose/ && ./acceptance_jdbcconfig 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-jdbcconfig
clean-acceptance-tests-jdbcconfig:
(cd compose/ && ./acceptance_jdbcconfig down -v)