-
Notifications
You must be signed in to change notification settings - Fork 10
525 lines (454 loc) · 24.1 KB
/
build.yml
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
name: Build
# We need to set these defaults so that .bashrc is called for each step.
# This is needed so that sdkman can be properly intialized
defaults:
run:
shell: bash -ieo pipefail {0}
on:
workflow_dispatch:
push:
branches:
- "main"
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{matrix.java-version}}
check-latest: true
cache: 'maven'
- name: Build with Maven
run: |
export FROM_SYSTEM_ENV=bar
mvn -B formatter:validate install --file pom.xml -DFROM_SYSTEM_PROPERTY=foo -Dtest-system-properties=true
verify-in-kubernetes:
name: Verify Extension in Kubernetes
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
jbang-version: [0.106.1]
needs: build
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{matrix.java-version}}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{matrix.java-version}}
check-latest: true
cache: 'maven'
- name: Setup sdkman
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdkman_auto_answer=false
sdkman_selfupdate_enable=false
- name: Setup jbang
run: |
sdk install jbang ${{matrix.jbang-version}}
sdk default jbang ${{matrix.jbang-version}}
- name: Build with Maven
run: mvn clean install -DskipTests
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1
with:
version: v0.11.1
registry: true
- name: Verify Integration Test Minimal
run: |
K8S_NAMESPACE=helm
KIND_REGISTRY_GROUP=local
VERSION=latest
kubectl create namespace $K8S_NAMESPACE
cd integration-tests/helm-kubernetes-minimal
mvn clean package -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true
# Get the project version
export QUARKUS_HELM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
jbang io.quarkiverse.helm:quarkus-helm-cli:$QUARKUS_HELM_VERSION lint
jbang io.quarkiverse.helm:quarkus-helm-cli:$QUARKUS_HELM_VERSION install -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/quarkus-helm-integration-tests-kubernetes-minimal:$VERSION
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=quarkus-helm-integration-tests-kubernetes-minimal -n $K8S_NAMESPACE
- name: Delete namespace "helm" using Helm
run: kubectl delete namespace helm
- name: Start Helm Repository (ChartMuseum)
run: docker run --rm -u 0 -it -d -p 8080:8080 -e DEBUG=1 -e STORAGE=local -e STORAGE_LOCAL_ROOTDIR=/charts -v $(pwd)/charts:/charts chartmuseum/chartmuseum:latest
- name: Verify Integration Test Minimal using Helm Repository
run: |
K8S_NAMESPACE=helmrepo
KIND_REGISTRY_GROUP=local
VERSION=latest
kubectl create namespace $K8S_NAMESPACE
# create image plus push to a Helm repository
cd integration-tests/helm-kubernetes-minimal
mvn clean package -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true \
-Dquarkus.helm.repository.push=true \
-Dquarkus.helm.repository.url=http://localhost:8080/api/charts \
-Dquarkus.helm.repository.type=CHARTMUSEUM
# Install Helm repository
helm repo add local http://localhost:8080
# And install application from the Helm repository
helm install --devel quarkus-hello-world local/quarkus-helm-integration-tests-kubernetes-minimal -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/quarkus-helm-integration-tests-kubernetes-minimal:$VERSION
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=quarkus-helm-integration-tests-kubernetes-minimal -n $K8S_NAMESPACE
- name: (Only if it failed) Log Integration Test Minimal using Helm Repository at failures
if: failure()
run: |
K8S_NAMESPACE=helmrepo
echo "Deployment resource:"
kubectl get deployment quarkus-helm-integration-tests-kubernetes-minimal -o yaml -n $K8S_NAMESPACE
echo "Logs of the deployment:"
kubectl logs deploy/quarkus-helm-integration-tests-kubernetes-minimal --all-containers=true -n $K8S_NAMESPACE
POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=quarkus-helm-integration-tests-kubernetes-minimal -o name -n $K8S_NAMESPACE)
echo "Describe pod:"
kubectl describe $POD_NAME -n $K8S_NAMESPACE
echo "Logs of running pod:"
kubectl logs $POD_NAME -n $K8S_NAMESPACE
echo "Logs of terminated pod:"
kubectl logs -p $POD_NAME -n $K8S_NAMESPACE
- name: Delete namespace "helmrepo" using Helm
run: kubectl delete namespace helmrepo
- name: Verify Integration Test With Templates using Helm Repository
run: |
K8S_NAMESPACE=helmtemplates
KIND_REGISTRY_GROUP=local
VERSION=latest
kubectl create namespace $K8S_NAMESPACE
# create image plus push to a Helm repository
cd integration-tests/helm-kubernetes-with-templates
mvn clean package -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true \
-Dquarkus.helm.repository.push=true \
-Dquarkus.helm.repository.url=http://localhost:8080/api/charts \
-Dquarkus.helm.repository.type=CHARTMUSEUM
# Update Helm repository
helm repo update local
# And install application from the Helm repository
helm install --devel quarkus-with-templates local/my-chart-with-templates -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/quarkus-helm-integration-tests-kubernetes-with-templates:$VERSION --set app.favorite.drink=coca
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE
if [ $(kubectl get configmap/my-configmap -n $K8S_NAMESPACE -o yaml | grep "drink: coca" | wc -l) -ne 1 ]
then
echo ConfigMap with wrong content
kubectl get configmap/my-configmap -n $K8S_NAMESPACE -o yaml
exit 1
fi
if [ $(kubectl get services/quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE -o jsonpath='{.metadata.labels}' | grep \"generator\":\"helm\" | wc -l) -ne 1 ]
then
echo Service with wrong content
kubectl get services/quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE -o yaml
exit 1
fi
if [ $(kubectl get services/quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE -o jsonpath='{.metadata.annotations}' | grep \"app.quarkus.io/build-timestamp\":\"my-ch\" | wc -l) -ne 1 ]
then
echo Service with wrong content
kubectl get services/quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE -o yaml
exit 1
fi
# Verify the if statement works:
## By default, the ingress "my-ingress" should have been installed
if [ $(kubectl get ingress/my-ingress -n $K8S_NAMESPACE -o jsonpath='{.metadata.name}' | grep my-ingress | wc -l) -ne 1 ]
then
echo "Ingress not found!"
exit 1
fi
## Let's update our Helm chart by not installing the ingress
helm upgrade --devel quarkus-with-templates local/my-chart-with-templates -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/quarkus-helm-integration-tests-kubernetes-with-templates:$VERSION --set app.favorite.drink=coca --set app.ingress.enabled=false
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=quarkus-helm-integration-tests-kubernetes-with-templates -n $K8S_NAMESPACE
## Now, the ingress "my-ingress" should have NOT been installed
if [ $(kubectl get ingress/my-ingress -n $K8S_NAMESPACE -o jsonpath='{.metadata.name}' | grep my-ingress | wc -l) -ne 0 ]
then
echo "Ingress was found!"
exit 1
fi
- name: Delete namespace "helmtemplates" using Helm
run: kubectl delete namespace helmtemplates
- name: Verify Integration Test With Dependency
run: |
K8S_NAMESPACE=helmdeps1
KIND_REGISTRY_GROUP=local
VERSION=latest
NAME=quarkus-helm-integration-tests-kubernetes-with-dependency
kubectl create namespace $K8S_NAMESPACE
# create image plus push to a Helm repository
cd integration-tests/helm-kubernetes-with-dependency
mvn clean package -DskipTests -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true
# And install application
helm install quarkus-with-dependency target/helm/kubernetes/quarkus-helm-integration-tests-kubernetes-with-dependency --dependency-update -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/$NAME:$VERSION
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=$NAME -n $K8S_NAMESPACE
- name: Delete namespace "helmdeps1"
run: kubectl delete namespace helmdeps1
- name: Verify Integration Test With Dependency Disabled
run: |
K8S_NAMESPACE=helmdeps2
KIND_REGISTRY_GROUP=local
VERSION=latest
NAME=quarkus-helm-integration-tests-kubernetes-with-dependency
kubectl create namespace $K8S_NAMESPACE
# create image plus push to a Helm repository
cd integration-tests/helm-kubernetes-with-dependency
mvn clean package -DskipTests -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true
# And install application
helm install quarkus-with-dependency target/helm/kubernetes/quarkus-helm-integration-tests-kubernetes-with-dependency --dependency-update -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/$NAME:$VERSION --set postgresql.enabled=false
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=$NAME -n $K8S_NAMESPACE
- name: Delete namespace "helmdeps2"
run: kubectl delete namespace helmdeps2
- name: Verify Integration Test With Config
run: |
K8S_NAMESPACE=helmconfig
KIND_REGISTRY_GROUP=local
VERSION=latest
NAME=quarkus-helm-integration-tests-kubernetes-config
kubectl create namespace $K8S_NAMESPACE
# create image plus push to a Helm repository
cd integration-tests/helm-kubernetes-config
mvn clean package -DskipTests -Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true
# And install application
helm install quarkus-with-config target/helm/kubernetes/quarkus-helm-integration-tests-kubernetes-config -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/$NAME:$VERSION --set app.number=3 --set app.flag=true --set app.message="Hello %s from helm"
# Wait for the app to start
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=$NAME -n $K8S_NAMESPACE
# Verify application
# POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=$NAME -n $K8S_NAMESPACE -o name)
# RESULT=$(kubectl exec -n $K8S_NAMESPACE $POD_NAME -- wget -qO- http://localhost:8080/)
# if [[ "$RESULT" = *"Hello World from helm, number=3, flag=true"* ]]
# then
# exit 0
# fi
# echo "Application is not working. Result was: $RESULT"
# exit 1
- name: Delete namespace "helmconfig"
run: kubectl delete namespace helmconfig
- name: Verify Super Hero microservice from Super Hero workshop using Helm Repository
run: |
K8S_NAMESPACE=super-heroes
KIND_REGISTRY_GROUP=local
VERSION=latest
QUARKUS_HELM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
QUARKUS_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${quarkus.version}' --non-recursive exec:exec)
kubectl create namespace $K8S_NAMESPACE
kubectl config set-context --current --namespace=$K8S_NAMESPACE
# checkout the quarkus super heroes repository
git clone https://github.com/quarkusio/quarkus-super-heroes
cd quarkus-super-heroes/rest-heroes
# install Quarkus Helm extension
./mvnw quarkus:add-extension -Dextensions="io.quarkiverse.helm:quarkus-helm:$QUARKUS_HELM_VERSION"
# remove the third party installations via templates (we'll install these services via Helm dependencies :) )
rm -rf src/main/kubernetes
# remove the default application.yml as we'll provide a different one with our Helm properties
rm -rf src/main/resources/application.yml
# copy the import.sql file from
cp deploy/db-init/initialize-tables.sql src/main/resources/
cat > src/main/resources/application.properties << "EOF"
quarkus.application.name=rest-heroes
quarkus.http.port=8080
quarkus.hibernate-orm.sql-load-script=initialize-tables.sql
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.datasource.reactive.url=postgresql://quarkus-rest-heroes-db:5432/heroes_database
quarkus.datasource.username=${DATASOURCE_USER}
quarkus.datasource.password=${DATASOURCE_PASSWORD:superman}
quarkus.kubernetes.deployment-target=kubernetes
quarkus.kubernetes.prometheus.generate-service-monitor=false
quarkus.helm.dependencies.postgresql.alias=db
quarkus.helm.dependencies.postgresql.version=11.9.1
quarkus.helm.dependencies.postgresql.repository=https://charts.bitnami.com/bitnami
quarkus.helm.dependencies.postgresql.wait-for-service=quarkus-rest-heroes-db:5432
quarkus.helm.values."db.auth.database".value=heroes_database
quarkus.helm.values."db.auth.username".value=superman
quarkus.helm.values."db.auth.password".value=superman
quarkus.helm.values."app.envs.DATASOURCE_USER".value=superman
EOF
# generate helm manifests
./mvnw clean package -DskipTests \
-Dquarkus.platform.version=$QUARKUS_VERSION -Dquarkus.platform.group-id=io.quarkus \
-Dquarkus.container-image.builder=docker \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$KIND_REGISTRY \
-Dquarkus.container-image.group=$KIND_REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION \
-Dquarkus.container-image.insecure=true \
-Dquarkus.helm.repository.push=true \
-Dquarkus.helm.repository.url=http://localhost:8080/api/charts \
-Dquarkus.helm.repository.type=CHARTMUSEUM
# Update Helm repository
helm repo update local
# And install application from the Helm repository
helm install quarkus-rest-heroes local/rest-heroes -n $K8S_NAMESPACE --set app.image=$KIND_REGISTRY/$KIND_REGISTRY_GROUP/rest-heroes:$VERSION
kubectl wait --timeout=160s --for=condition=ready pod -l app.kubernetes.io/name=rest-heroes -n $K8S_NAMESPACE
POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=rest-heroes -n $K8S_NAMESPACE -o name)
if [ $(kubectl exec -i $POD_NAME --container rest-heroes -n $K8S_NAMESPACE -- sh -c "curl -s -i localhost:8080") = *"500 Internal Server Error"* ]
then
echo Service rest-heroes is not working
kubectl describe $POD_NAME
kubectl logs $POD_NAME
exit 1
fi
- name: (Only if it failed) Log REST Heroes traces at failures
if: failure()
run: |
echo "Deployment resource:"
kubectl get deployment rest-heroes -o yaml
echo "Logs of the deployment:"
kubectl logs deploy/rest-heroes --all-containers=true -n $KUBERNETES_NAMESPACE
POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=rest-heroes -o name)
echo "Describe pod:"
kubectl describe $POD_NAME
echo "Logs of running pod:"
kubectl logs $POD_NAME
echo "Logs of terminated pod:"
kubectl logs -p $POD_NAME
- name: Delete namespace "super-heroes" using Helm
run: kubectl delete namespace super-heroes
verify-in-openshift:
name: Verify Extension in OpenShift
# the action "manusa/[email protected]" only works in ubuntu-20.04
runs-on: ubuntu-20.04
needs: verify-in-kubernetes
# the step "manusa/actions-setup-openshift" is broken:
if: false
strategy:
matrix:
java-version: [ 17 ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{matrix.java-version}}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{matrix.java-version}}
check-latest: true
cache: 'maven'
- name: Build with Maven
run: mvn clean install -DskipTests
- name: Setup OpenShift
uses: manusa/[email protected]
with:
oc version: v3.11.0
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Super Hero microservice from Super Hero workshop
run: |
OC_NAMESPACE=super-heroes
REGISTRY_PORT=5000
REGISTRY=localhost:$REGISTRY_PORT
REGISTRY_GROUP=jcarvaja
VERSION=openshift
QUARKUS_HELM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
QUARKUS_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${quarkus.version}' --non-recursive exec:exec)
oc new-project $OC_NAMESPACE
# setup container registry
oc new-app registry:2 -l app=registry
oc wait --timeout=160s --for=condition=ready pod -l app=registry
# checkout the quarkus super heroes repository
git clone https://github.com/quarkusio/quarkus-super-heroes
cd quarkus-super-heroes/rest-heroes
# install Quarkus Helm extension
./mvnw quarkus:add-extension -Dextensions="io.quarkiverse.helm:quarkus-helm:$QUARKUS_HELM_VERSION"
# remove the third party installations via templates (we'll install these services via Helm dependencies :) )
rm -rf src/main/kubernetes
# remove the default application.yml as we'll provide a different one with our Helm properties
rm -rf src/main/resources/application.yml
# copy the import.sql file from
cp deploy/db-init/initialize-tables.sql src/main/resources/
cat > src/main/resources/application.properties << "EOF"
quarkus.application.name=rest-heroes
quarkus.http.port=8080
quarkus.hibernate-orm.sql-load-script=initialize-tables.sql
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.datasource.reactive.url=postgresql://quarkus-rest-heroes-db:5432/heroes_database
quarkus.datasource.username=superman
quarkus.datasource.password=superman
quarkus.kubernetes.deployment-target=openshift
quarkus.helm.dependencies.postgresql.alias=db
quarkus.helm.dependencies.postgresql.version=11.9.1
quarkus.helm.dependencies.postgresql.repository=https://charts.bitnami.com/bitnami
quarkus.helm.dependencies.postgresql.wait-for-service=quarkus-rest-heroes-db:5432
quarkus.helm.values."db.auth.database".value=heroes_database
quarkus.helm.values."db.auth.username".value=superman
quarkus.helm.values."db.auth.password".value=superman
quarkus.helm.values."db.volumePermissions.enabled".value-as-bool=false
quarkus.helm.values."db.volumePermissions.securityContext.runAsUser".value=auto
quarkus.helm.values."db.securityContext.enabled".value-as-bool=false
quarkus.helm.values."db.shmVolume.chmod.enabled".value-as-bool=false
quarkus.helm.values."db.primary.containerSecurityContext.enabled".value-as-bool=false
quarkus.helm.values."db.primary.containerSecurityContext.runAsUser".value=auto
quarkus.helm.values."db.primary.podSecurityContext.enabled".value-as-bool=false
quarkus.helm.values."db.primary.podSecurityContext.fsGroup".value=auto
EOF
# start port-forward to allow pushing images to our registry
oc port-forward $(oc get pod -l app=registry -o name) $REGISTRY_PORT:5000 &
PF_REGISTRY_PID=$!
# generate helm manifests
./mvnw clean package -DskipTests \
-Dquarkus.platform.version=$QUARKUS_VERSION -Dquarkus.platform.group-id=io.quarkus \
-Dquarkus.container-image.builder=docker \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry=$REGISTRY \
-Dquarkus.container-image.group=$REGISTRY_GROUP \
-Dquarkus.container-image.tag=$VERSION
# after pushing the image, we can now stop the port forwarding
kill -9 $PF_REGISTRY_PID
# And install application
helm install --dependency-update quarkus-rest-heroes target/helm/openshift/rest-heroes/ --set app.image=registry:5000/$REGISTRY_GROUP:$VERSION
oc wait --timeout=160s --for=condition=ready pod -l app.kubernetes.io/name=rest-heroes
POD_NAME=$(oc get pod -l app.kubernetes.io/name=rest-heroes -o name)
if [ $(oc exec -i $POD_NAME --container rest-heroes -- sh -c "curl -s -i localhost:8080") = *"500 Internal Server Error"* ]
then
echo Service rest-heroes is not working
oc describe $POD_NAME
oc logs $POD_NAME
exit 1
fi
- name: Delete namespace "super-heroes" using Helm
run: oc delete project super-heroes