From 9d0038df00af382584c19be93daaab6e676ed12c Mon Sep 17 00:00:00 2001 From: ange Date: Wed, 15 May 2024 17:49:04 +0200 Subject: [PATCH] feat: retry RUNNER_TOKEN while null --- manifests/bin/deploy.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/bin/deploy.sh b/manifests/bin/deploy.sh index e7cae54..e5164ec 100755 --- a/manifests/bin/deploy.sh +++ b/manifests/bin/deploy.sh @@ -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