From 8f5783221baf29e7e9080f2f302109d44cbad645 Mon Sep 17 00:00:00 2001 From: Omri Assa Date: Sun, 1 Dec 2024 19:54:14 +0200 Subject: [PATCH] fix: gitlab script cleanup --- scripts/init-gitlab.sh | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/scripts/init-gitlab.sh b/scripts/init-gitlab.sh index a2ce2eb..fe0dd3e 100644 --- a/scripts/init-gitlab.sh +++ b/scripts/init-gitlab.sh @@ -19,24 +19,8 @@ if [ -z "$(helm list -n gitlab | grep gitlab)" ]; then helm repo add gitlab https://charts.gitlab.io/ helm upgrade --install gitlab -n gitlab gitlab/gitlab -f gitlab.values.yaml - timeout 5m bash -c ' - while true; do - # Get the pod status using kubectl - POD_STATUS=$(kubectl get pods -n gitlab -l app=webservice -o jsonpath='{.items[0].status.phase}') - - # Check if the pod is in 'Running' state - if [ "${POD_STATUS}" = "Running" ]; then - echo "Pod is ready, continuing with next steps..." - sleep 10 - break # Exit the loop - else - echo "Pod is not ready yet. Current status: $POD_STATUS" - sleep 5 # Wait for 5 seconds before checking again - fi - done - ' - - GITLAB_TOOLBOX_POD=$(kubectl get pods --namespace gitlab -l app=toolbox -o name | sed 's|pod/||') + kubectl wait --namespace gitlab --for=condition=ready pod -l app=toolbox --timeout=360s + GITLAB_TOOLBOX_POD=$(kubectl get pods --namespace gitlab -l app=toolbox -o name) TOKENS_OUTPUT=$(kubectl exec -it -c toolbox ${GITLAB_TOOLBOX_POD} -n gitlab -- gitlab-rails runner /tmp/scripts/piper-setup.rb) echo $TOKENS_OUTPUT else