scripts/deploy: factor out a deployHelper to make variant=all usable *without* host=all

This commit is contained in:
2024-06-14 18:06:51 +00:00
parent 46f5a7e37d
commit 26a4f20f6c

View File

@@ -114,22 +114,28 @@ deployOneHost() {
parseArgs "$@" parseArgs "$@"
failedDeploys=() failedDeploys=()
if [ "$host" = "all" ]; then # deployHelper is like `deployOneHost`,
for host in moby lappy crappy servo desko; do # but it handles the special cases of `host=all` or `variant=all`,
if [ "$variant" = "all" ]; then # and aggregates failed deployments into the `failedDeploys` var.
for variant in -min -light ""; do deployHelper() {
deployOneHost "$host" "$variant" || \ local host="$1"
failedDeploys+=("$host$variant") local variant="$2"
done
else if [ "$host" = "all" ]; then
deployOneHost "$host" "$variant" || \ for host in moby lappy crappy servo desko; do
failedDeploys+=("$host$variant") deployHelper "$host" "$variant"
fi done
done elif [ "$variant" = "all" ]; then
else for variant in -min -light ""; do
deployOneHost "$host" "$variant" || \ deployHelper "$host" "$variant"
failedDeploys+=("$host$variant") done
fi else
deployOneHost "$host" "$variant" || \
failedDeploys+=("$host$variant")
fi
}
deployHelper "$host" "$variant"
if [ "${#failedDeploys[@]}" -ne 0 ]; then if [ "${#failedDeploys[@]}" -ne 0 ]; then
echo "FAILED DEPLOYMENT:" echo "FAILED DEPLOYMENT:"