Files
homelab/common/scripts/deploy-pattern.sh
rblundon 939177be6b Squashed 'acm-hub-bootstrap/' content from commit 4b79b1a0
git-subtree-dir: acm-hub-bootstrap
git-subtree-split: 4b79b1a0be6da2a9efc9ace8871b4762342da70b
2025-04-14 23:43:59 -05:00

28 lines
591 B
Bash
Executable File

#!/bin/bash
set -o pipefail
RUNS=10
WAIT=15
# Retry five times because the CRD might not be fully installed yet
echo -n "Installing pattern: "
for i in $(seq 1 ${RUNS}); do \
exec 3>&1 4>&2
OUT=$( { helm template --include-crds --name-template $* 2>&4 | oc apply -f- 2>&4 1>&3; } 4>&1 3>&1)
ret=$?
exec 3>&- 4>&-
if [ ${ret} -eq 0 ]; then
break;
else
echo -n "."
sleep "${WAIT}"
fi
done
# All the runs failed
if [ ${i} -eq ${RUNS} ]; then
echo "Installation failed [${i}/${RUNS}]. Error:"
echo "${OUT}"
exit 1
fi
echo "Done"