11#! /usr/bin/env bash
22set -eo pipefail
33shopt -s expand_aliases
4- alias podman=" podman --storage-driver=vfs -- cgroup-manager=cgroupfs --events-backend=file"
4+ alias podman=" podman --cgroup-manager=cgroupfs --events-backend=file"
55
66function clean_before_exit {
77 # delay before exiting, so stdout/stderr flushes through the logging system
@@ -11,33 +11,18 @@ function clean_before_exit {
1111}
1212trap clean_before_exit EXIT
1313
14- function waiting_podman {
15- echo " ---> Waiting podman system service"
16- for i in {0..3}; do
17- pid=$( pgrep podman)
18- if [ ! -n " $pid " ]; then
19- sleep 3
20- elif [ ! -n " $pid " ] && [[ $i == 3 ]]; then
21- echo " ---> Podman system service failed to start"
22- exit 1
23- else
24- sleep 1
25- break
26- fi
27- done
28- }
29-
30- function waiting_caddy {
31- echo " ---> Waiting caddy reverse-proxy"
14+ function waiting_process {
15+ echo -e " \033[32m---> Waiting $1 running.\033[0m"
3216 for i in {0..4}; do
33- pid=$( pgrep caddy)
34- if [ ! -n " $pid " ]; then
35- sleep 3
36- elif [ ! -n " $pid " ] && [[ $i == 3 ]]; then
37- echo " ---> Caddy failed to start"
17+ pid=$( pgrep $1 )
18+ if [ ! -n " $pid " ] && [[ $i == 3 ]]; then
19+ echo -e " \033[31m---> Process $1 failed.\033[0m"
3820 exit 1
21+ elif [ ! -n " $pid " ]; then
22+ sleep 3
3923 else
4024 sleep 1
25+ echo -e " \033[32m---> Process $1 started.\033[0m"
4126 break
4227 fi
4328 done
@@ -56,7 +41,7 @@ podman system service \
5641 --log-level " ${log_level} " \
5742 --time 0 " ${DOCKER_HOST} " &
5843
59- waiting_podman
44+ waiting_process podman
6045
6146if [[ -n " ${TAR_PATH} " ]]; then
6247 get_object
8267 caddy reverse-proxy \
8368 --from " :${DRYCC_REGISTRY_PROXY_PORT} " \
8469 --to " ${DRYCC_REGISTRY_SERVICE_HOST} :${DRYCC_REGISTRY_SERVICE_PORT} " &
85- waiting_caddy
70+ waiting_process caddy
8671 podman login \
8772 --username drycc \
8873 --password drycc \
117102echo " ---> Publishing image"
118103podman tag " ${image_cache_repo} " " ${image_repo} "
119104podman push " ${image_cache_repo} " --tls-verify=false
120- podman push " ${image_repo} " --tls-verify=false
105+ podman push " ${image_repo} " --tls-verify=false
0 commit comments