feat: retry RUNNER_TOKEN while null

This commit is contained in:
ange 2024-05-15 17:49:04 +02:00
parent 234bc3d169
commit 9d0038df00
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D

View File

@ -60,9 +60,13 @@ kapply common/job.yaml \
kubectl rollout restart statefulset app
RUNNER_TOKEN="$(curl "http://$GITEA_USERNAME:$GITEA_PASSWORD@app/api/v1/admin/runners/registration-token" | jq .token || true)"
if [ -n "$RUNNER_TOKEN" ]; then
kcreatesec runner-secret --from-literal=token="$RUNNER_TOKEN"
kapply common/runner.yaml
kubectl rollout restart statefulset runner
fi
for i in {0..9}; do
RUNNER_TOKEN="$(curl "http://$GITEA_USERNAME:$GITEA_PASSWORD@app/api/v1/admin/runners/registration-token" | jq .token)"
if [ "$RUNNER_TOKEN" != null ]; then
kcreatesec runner-secret --from-literal=token="$RUNNER_TOKEN"
kapply common/runner.yaml
kubectl rollout restart statefulset runner
break
fi
done