Files
homelab/common/scripts/preview-all.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

26 lines
826 B
Bash
Executable File

#!/bin/bash
REPO=$1; shift;
TARGET_BRANCH=$1; shift
HUB=$( yq ".main.clusterGroupName" values-global.yaml )
MANAGED_CLUSTERS=$( yq ".clusterGroup.managedClusterGroups.[].name" values-$HUB.yaml )
ALL_CLUSTERS=( $HUB $MANAGED_CLUSTERS )
CLUSTER_INFO_OUT=$(oc cluster-info 2>&1)
CLUSTER_INFO_RET=$?
if [ $CLUSTER_INFO_RET -ne 0 ]; then
echo "Could not access the cluster:"
echo "${CLUSTER_INFO_OUT}"
exit 1
fi
for cluster in ${ALL_CLUSTERS[@]}; do
# We always add clustergroup as it is the entry point and it gets special cased in preview.sh.
APPS="clustergroup $( yq ".clusterGroup.applications.[].name" values-$cluster.yaml )"
for app in $APPS; do
printf "# Parsing application $app from cluster $cluster\n"
common/scripts/preview.sh $cluster $app $REPO $TARGET_BRANCH
done
done