From bfabf0ffcbcc3aa7bce1fc8d36aafce1273e51d2 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Tue, 21 May 2024 06:45:08 +0000 Subject: [PATCH] chore: using loop to check status --- .../setup-greptimedb-cluster/action.yml | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/actions/setup-greptimedb-cluster/action.yml b/.github/actions/setup-greptimedb-cluster/action.yml index 91a02363a3e4..bd10479bf3a9 100644 --- a/.github/actions/setup-greptimedb-cluster/action.yml +++ b/.github/actions/setup-greptimedb-cluster/action.yml @@ -58,27 +58,17 @@ runs: - name: Wait for GreptimeDB shell: bash run: | - sleep 5s - kubectl get pods -n my-greptimedb - kubectl wait \ - --for=condition=Ready \ - pod -l app.greptime.io/component=my-greptimedb-meta \ - --timeout=120s \ - -n my-greptimedb - sleep 5s - kubectl get pods -n my-greptimedb - kubectl wait \ - --for=condition=Ready \ - pod -l app.greptime.io/component=my-greptimedb-datanode \ - --timeout=120s \ - -n my-greptimedb - sleep 5s - kubectl get pods -n my-greptimedb - kubectl wait \ - --for=condition=Ready \ - pod -l app.greptime.io/component=my-greptimedb-frontend \ - --timeout=120s \ - -n my-greptimedb + while true; do + PHASE=$(kubectl -n my-greptimedb get gtc my-greptimedb -o jsonpath='{.status.clusterPhase}') + if [ "$PHASE" == "Running" ]; then + echo "Cluster is ready" + break + else + echo "Cluster is not ready yet: Current phase: $PHASE" + kubectl get pods -n my-greptimedb + sleep 5 # wait for 5 seconds before check again. + fi + done - name: Print GreptimeDB info if: always() shell: bash