Skip to content

Commit

Permalink
check also if backstage is synced (not healthy)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleinlercher authored May 5, 2024
1 parent 421515c commit 9ba231e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions install-k3d-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@ export ARGOCD_AUTH_TOKEN="argocd.token=$( argocd account generate-token --accoun
ID=$( curl -k -X POST https://grafana-127-0-0-1.nip.io/api/serviceaccounts --user 'admin:prom-operator' -H "Content-Type: application/json" -d '{"name": "backstage","role": "Viewer","isDisabled": false}' | jq -r .id )
export GRAFANA_TOKEN=$(curl -k -X POST https://grafana-127-0-0-1.nip.io/api/serviceaccounts/${ID}/tokens --user 'admin:prom-operator' -H "Content-Type: application/json" -d '{"name": "backstage"}' | jq -r .key)


# max wait for 3 minutes
end=$((SECONDS+180))
argocd_apps="sx-backstage"

all_apps_synced="true"
while [ $SECONDS -lt $end ]; do
all_apps_synced="true"
for app in ${argocd_apps} ; do
kubectl get application -n argocd ${app} | grep "Synced"
exit_code=$?
if [[ $exit_code -ne 0 ]]; then
all_apps_synced="false"
fi
done
if [ ${all_apps_synced} = "true" ] ; then
echo "backstage app is synced"
break
fi
kubectl get application -n argocd
sleep 10
done

export K8S_SA_TOKEN=$( kubectl get secret backstage-locator -n backstage -o jsonpath='{.data.token}' | base64 -d )
kubectl create secret generic -n backstage manual-secret --from-literal=GITHUB_CLIENTSECRET=${GITHUB_CLIENTSECRET} --from-literal=GITHUB_CLIENTID=${GITHUB_CLIENTID} --from-literal=GITHUB_ORG=${GITHUB_ORG} --from-literal=GITHUB_TOKEN=${GITHUB_TOKEN} --from-literal=K8S_SA_TOKEN=${K8S_SA_TOKEN} --from-literal=ARGOCD_AUTH_TOKEN=${ARGOCD_AUTH_TOKEN} --from-literal=GRAFANA_TOKEN=${GRAFANA_TOKEN}
kubectl rollout restart deploy/sx-backstage -n backstage
Expand Down

0 comments on commit 9ba231e

Please sign in to comment.