forked from liferay/liferay-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_all_images.sh
executable file
·577 lines (436 loc) · 16.9 KB
/
build_all_images.sh
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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
#!/bin/bash
source ./_common.sh
function build_base_image {
log_in_to_docker_hub
if [[ $(get_latest_docker_hub_version "base") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Base is up to date."
return
fi
echo ""
echo "Building Docker image Base."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_base_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/base.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Base" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Base" >> "${LOGS_DIR}/results"
fi
}
function build_bundle_image {
local query=${1}
local version=${2}
local additional_tags=$(get_string $( yq "${query}".additional_tags < bundles.yml))
local bundle_url=$(get_string $(yq "${query}".bundle_url < bundles.yml))
local fix_pack_url=$(get_string $(yq "${query}".fix_pack_url < bundles.yml))
local latest=$(get_string $(yq "${query}".latest < bundles.yml))
local test_hotfix_url=$(get_string $(yq "${query}".test_hotfix_url < bundles.yml))
local test_installed_patch=$(get_string $( yq "${query}".test_installed_patch < bundles.yml))
if [ -n "${additional_tags}" ]
then
version="${version},${additional_tags}"
fi
if [ ! -n "${version}" ]
then
local build_id=${bundle_url##*/}
else
local build_id=${version}
fi
echo ""
echo "Building Docker image ${build_id} based on ${bundle_url}."
echo ""
LIFERAY_DOCKER_FIX_PACK_URL=${fix_pack_url} LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_LATEST=${latest} LIFERAY_DOCKER_RELEASE_FILE_URL=${bundle_url} LIFERAY_DOCKER_RELEASE_VERSION=${version} LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" LIFERAY_DOCKER_TEST_HOTFIX_URL=${test_hotfix_url} LIFERAY_DOCKER_TEST_INSTALLED_PATCHES=${test_installed_patch} time ./build_bundle_image.sh "${BUILD_ALL_IMAGES_PUSH}" 2>&1 | tee "${LOGS_DIR}/${build_id}.log"
local build_bundle_image_exit_code=${PIPESTATUS[0]}
if [ "${build_bundle_image_exit_code}" -gt 0 ]
then
echo "FAILED: ${build_id}" >> "${LOGS_DIR}/results"
if [ "${build_bundle_image_exit_code}" -eq 4 ]
then
echo "Detected a license failure while building image ${build_id}." > "${LOGS_DIR}/license-failure"
echo "There is an existing license failure."
exit 4
fi
else
echo "SUCCESS: ${build_id}" >> "${LOGS_DIR}/results"
fi
}
function build_bundle_images {
#
# LIFERAY_DOCKER_IMAGE_FILTER="7.2.10-dxp-1 " ./build_all_images.sh
# LIFERAY_DOCKER_IMAGE_FILTER=7.2.10 ./build_all_images.sh
#
local main_keys=$(yq '' < bundles.yml | grep -v ' .*' | sed 's/://')
local specified_version=${LIFERAY_DOCKER_IMAGE_FILTER}
if [ -z "${LIFERAY_DOCKER_IMAGE_FILTER}" ]
then
specified_version="*"
fi
local search_output=$(yq .\""${specified_version}"\" < bundles.yml)
if [[ "${search_output}" != "null" ]]
then
local versions=$(echo "${search_output}" | grep '^.*:$' | sed 's/://')
for version in ${versions}
do
local query=.\"$(get_main_key "${main_keys}" "${version}")\".\"${version}\"
build_bundle_image "${query}" "${version}"
done
else
local main_key=$(get_main_key "${main_keys}" "${specified_version}")
if [[ "${main_key}" = "null" ]]
then
echo "No bundles were found."
exit 1
else
local query=.\"${main_key}\".\"${specified_version}\"
if [[ "$(yq "${query}" < bundles.yml)" != "null" ]]
then
build_bundle_image "${query}" "${specified_version}"
else
echo "No bundles were found."
exit 1
fi
fi
fi
}
function build_caddy_image {
if [[ $(get_latest_docker_hub_version "caddy") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Caddy is up to date."
return
fi
echo ""
echo "Building Docker image Caddy resources."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_caddy_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/caddy.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Caddy" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Caddy" >> "${LOGS_DIR}/results"
fi
}
function build_dynamic_rendering_image {
if [[ $(get_latest_docker_hub_version "job-runner") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Dynamic Rendering is up to date."
return
fi
echo ""
echo "Building Docker image Dynamic Rendering."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_dynamic_rendering_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/dynamic_rendering.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Dynamic Rendering" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Dynamic Rendering" >> "${LOGS_DIR}/results"
fi
}
function build_jar_runner_image {
if [[ $(get_latest_docker_hub_version "jar-runner") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image JAR Runner is up to date."
return
fi
echo ""
echo "Building Docker image JAR Runner."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_jar_runner_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/jar_runner.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: JAR Runner" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: JAR Runner" >> "${LOGS_DIR}/results"
fi
}
function build_jdk11_image {
local latest_available_zulu11_amd64_version=$(get_latest_available_zulu_version "11" "amd64")
local latest_available_zulu11_arm64_version=$(get_latest_available_zulu_version "11" "arm64")
if [[ $(get_latest_docker_hub_zulu_version "jdk11" "11" "amd64") == "${latest_available_zulu11_amd64_version}" ]] && [[ $(get_latest_docker_hub_zulu_version "jdk11" "11" "arm64") == "${latest_available_zulu11_arm64_version}" ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image JDK 11 is up to date."
return
fi
echo ""
echo "Building Docker image JDK 11."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" LIFERAY_DOCKER_ZULU_11_AMD64_VERSION=${latest_available_zulu11_amd64_version} LIFERAY_DOCKER_ZULU_11_ARM64_VERSION=${latest_available_zulu11_arm64_version} time ./build_jdk11_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/jdk11.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: JDK 11" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: JDK 11" >> "${LOGS_DIR}/results"
fi
}
function build_jdk11_jdk8_image {
local latest_available_zulu8_amd64_version=$(get_latest_available_zulu_version "8" "amd64")
local latest_available_zulu8_arm64_version=$(get_latest_available_zulu_version "8" "arm64")
if [[ $(get_latest_docker_hub_zulu_version "jdk11-jdk8" "8" "amd64") == "${latest_available_zulu8_amd64_version}" ]] && [[ $(get_latest_docker_hub_zulu_version "jdk11-jdk8" "8" "arm64") == "${latest_available_zulu8_arm64_version}" ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image JDK 8 is up to date."
return
fi
echo ""
echo "Building Docker image JDK 11/JDK 8."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" LIFERAY_DOCKER_ZULU_8_AMD64_VERSION=${latest_available_zulu8_amd64_version} LIFERAY_DOCKER_ZULU_8_ARM64_VERSION=${latest_available_zulu8_arm64_version} time ./build_jdk11_jdk8_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/jdk11_jdk8.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: JDK 11/JDK 8" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: JDK 11/JDK 8" >> "${LOGS_DIR}/results"
fi
}
function build_job_runner_image {
if [[ $(get_latest_docker_hub_version "job-runner") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Job Runner is up to date."
return
fi
echo ""
echo "Building Docker image Job Runner."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_job_runner_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/job_runner.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Job Runner" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Job Runner" >> "${LOGS_DIR}/results"
fi
}
function build_node_runner_image {
if [[ $(get_latest_docker_hub_version "node-runner") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Node Runner is up to date."
return
fi
echo ""
echo "Building Docker image Node Runner."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_node_runner_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/node_runner.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Node Runner" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Node Runner" >> "${LOGS_DIR}/results"
fi
}
function build_noop_image {
if [[ $(get_latest_docker_hub_version "noop") == $(./release_notes.sh get-version) ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image NOOP is up to date."
return
fi
echo ""
echo "Building Docker image NOOP."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" time ./build_noop_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/noop.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: NOOP" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: NOOP" >> "${LOGS_DIR}/results"
fi
}
function build_zabbix_server_image {
local latest_liferay_zabbix_server_version=$(get_latest_docker_hub_zabbix_server_version "liferay/zabbix-server")
local latest_official_zabbix_server_version=$(get_latest_docker_hub_zabbix_server_version "zabbix/zabbix-server-mysql")
if [[ "${latest_liferay_zabbix_server_version}" == "${latest_official_zabbix_server_version}" ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Zabbix Server is up to date."
return
fi
echo ""
echo "Building Docker image Zabbix Server."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" LIFERAY_DOCKER_ZABBIX_VERSION=${latest_official_zabbix_server_version} time ./build_zabbix_server_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/zabbix_server.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Zabbix Server" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Zabbix Server" >> "${LOGS_DIR}/results"
fi
}
function build_zabbix_web_image {
local latest_liferay_zabbix_server_web_interface_version=$(get_latest_docker_hub_zabbix_server_version "liferay/zabbix-web")
local latest_official_zabbix_server_web_interface_version=$(get_latest_docker_hub_zabbix_server_version "zabbix/zabbix-web-nginx-mysql")
if [[ "${latest_liferay_zabbix_server_web_interface_version}" == "${latest_official_zabbix_server_web_interface_version}" ]] && [[ "${LIFERAY_DOCKER_DEVELOPER_MODE}" != "true" ]]
then
echo ""
echo "Docker image Zabbix Web is up to date."
return
fi
echo ""
echo "Building Docker image Zabbix Web."
echo ""
LIFERAY_DOCKER_IMAGE_PLATFORMS="${LIFERAY_DOCKER_IMAGE_PLATFORMS}" LIFERAY_DOCKER_REPOSITORY="${LIFERAY_DOCKER_REPOSITORY}" LIFERAY_DOCKER_ZABBIX_VERSION=${latest_official_zabbix_server_web_interface_version} time ./build_zabbix_web_image.sh "${BUILD_ALL_IMAGES_PUSH}" | tee -a "${LOGS_DIR}"/zabbix_server_web_interface.log
if [ "${PIPESTATUS[0]}" -gt 0 ]
then
echo "FAILED: Zabbix Web" >> "${LOGS_DIR}/results"
exit 1
else
echo "SUCCESS: Zabbix Web" >> "${LOGS_DIR}/results"
fi
}
function get_latest_available_zulu_version {
local version=$(curl -H 'accept: */*' -L -s "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/?arch=${2}&bundle_type=jdk&ext=deb&hw_bitness=64&javafx=false&java_version=${1}&os=linux" | jq -r '.zulu_version | join(".")' | cut -f1,2,3 -d'.')
echo "${version}"
}
function get_latest_docker_hub_version {
local token=$(curl -s "https://auth.docker.io/token?scope=repository:liferay/${1}:pull&service=registry.docker.io" | jq -r '.token')
local version=$(curl -s -H "Authorization: Bearer $token" "https://registry-1.docker.io/v2/liferay/${1}/manifests/latest" | grep -o '\\"org.label-schema.version\\":\\"[0-9]\.[0-9]\.[0-9]*\\"' | head -1 | sed 's/\\"//g' | sed 's:.*\:::')
if [ -z "${version}" ]
then
docker pull "liferay/${1}:latest"
if [ $? -gt 0 ]
then
version="0"
else
version=$(docker image inspect --format '{{index .Config.Labels "org.label-schema.version"}}' "liferay/${1}:latest")
fi
echo "${version}"
else
echo "${version}"
fi
}
function get_latest_docker_hub_zabbix_server_version {
local image_tag="${1}"
local token=$(curl -s "https://auth.docker.io/token?scope=repository:${image_tag}:pull&service=registry.docker.io" | jq -r '.token')
local label_name="org.opencontainers.image.version"
local tag="ubuntu-latest"
if [[ "${image_tag}" =~ "liferay/" ]]
then
label_name="org.label-schema.zabbix-version"
tag="latest"
fi
local version=$(curl -s -H "Authorization: Bearer $token" "https://registry-1.docker.io/v2/${image_tag}/manifests/${tag}" | grep -o "\\\\\"${label_name}\\\\\":\\\\\"[0-9]*\.[0-9]*\.[0-9]*\\\\\"" | head -1 | sed 's/\\"//g' | sed 's:.*\:::')
echo "${version}"
}
function get_latest_docker_hub_zulu_version {
local token=$(curl -s "https://auth.docker.io/token?scope=repository:liferay/${1}:pull&service=registry.docker.io" | jq -r '.token')
local version=$(curl -s -H "Authorization: Bearer $token" "https://registry-1.docker.io/v2/liferay/${1}/manifests/latest" | grep -o "\\\\\"org.label-schema.zulu${2}_${3}_version\\\\\":\\\\\"[0-9]*\.[0-9]*\.[0-9]*\\\\\"" | head -1 | sed 's/\\"//g' | sed 's:.*\:::')
echo "${version}"
}
function get_main_key {
local main_keys=${1}
local version=${2}
for main_key in ${main_keys}
do
local count=$(echo "${version}" | grep -c -E "${main_key}-|${main_key}\.")
if [ "${count}" -gt 0 ]
then
echo "${main_key}"
break
fi
done
}
function get_string {
if [ "${1}" == "null" ]
then
echo ""
else
echo "${1}"
fi
}
function main {
check_utils 7z curl docker git java jq sed sort tr unzip yq
if [[ " ${@} " =~ " --push " ]]
then
BUILD_ALL_IMAGES_PUSH="push"
fi
if [ "${BUILD_ALL_IMAGES_PUSH}" == "push" ] && ! ./release_notes.sh fail-on-change
then
exit 1
fi
if [ "${BUILD_ALL_IMAGES_PUSH}" == "push" ] && [ -z "${LIFERAY_DOCKER_IMAGE_PLATFORMS}" ]
then
LIFERAY_DOCKER_IMAGE_PLATFORMS=linux/amd64,linux/arm64
fi
if [ -z "${LIFERAY_DOCKER_REPOSITORY}" ]
then
LIFERAY_DOCKER_REPOSITORY=liferay
fi
validate_bundles_yml
LOGS_DIR=logs-$(date "$(date)" "+%Y%m%d%H%M")
mkdir -p "${LOGS_DIR}"
build_base_image
build_jdk11_image
build_jdk11_jdk8_image
build_caddy_image
build_jar_runner_image
build_job_runner_image
build_node_runner_image
build_noop_image
build_zabbix_server_image
build_zabbix_web_image
build_bundle_images
echo ""
echo "Results: "
echo ""
cat "${LOGS_DIR}/results"
if [ $(grep -c "FAILED" "${LOGS_DIR}/results") != 0 ]
then
exit 1
fi
}
function validate_bundles_yml {
if [ $(yq '.*.*.latest' < bundles.yml | grep "true" -c) -gt 2 ]
then
echo "There are too many images designated as latest."
exit 1
fi
local dxp_latest_key_counter=0
local main_keys=$(yq '' < bundles.yml | grep -v ' .*' | sed 's/://')
local portal_latest_key_counter=0
for main_key in ${main_keys}
do
if [ $(yq .\""${main_key}"\".*.latest < bundles.yml | grep "true\|false" -c) -gt 0 ]
then
local minor_keys=$(yq .\""${main_key}"\" < bundles.yml | grep -v ' .*' | sed 's/://')
for minor_key in ${minor_keys}
do
if [ $(yq .\""${main_key}"\".\""${minor_key}"\".latest < bundles.yml | grep "true\|false" -c) -gt 0 ]
then
if [ $(yq .\""${main_key}"\".\""${minor_key}"\".bundle_url < bundles.yml | grep "portal-tomcat") ]
then
portal_latest_key_counter=$((portal_latest_key_counter+1))
elif [ $(yq .\""${main_key}"\".\""${minor_key}"\".bundle_url < bundles.yml | grep "dxp-tomcat") ]
then
dxp_latest_key_counter=$((dxp_latest_key_counter+1))
fi
fi
done
fi
done
if [ ${dxp_latest_key_counter} -gt 1 ]
then
echo "There are ${dxp_latest_key_counter} latest DXP images."
exit 1
elif [ ${portal_latest_key_counter} -gt 1 ]
then
echo "There are ${portal_latest_key_counter} latest portal images."
exit 1
fi
}
main "${@}"