@@ -100,24 +100,35 @@ jobs:
100100 run : |
101101 nohup yarn start --no-base-path --no-watch --csp.warnLegacyBrowsers=false | tee dashboard.log &
102102 shell : bash
103+ working-directory : OpenSearch-Dashboards
103104
104- # Check if OSD is ready with a max timeout of 600 seconds
105- - name : Check If OpenSearch Dashboards Is Ready
105+ # Check if OSD is ready with a max timeout of 60 seconds
106+ - name : Wait for OpenSearch Dashboards (status API)
107+ shell : bash
108+ working-directory : OpenSearch-Dashboards
109+ env :
110+ OSD_URL : http://localhost:5601
111+ OSD_USER : admin
112+ OSD_PASS : ${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}
113+ TIMEOUT : " 200" # seconds
114+ INTERVAL : " 5" # seconds
106115 run : |
107- echo "Start checking OpenSearch Dashboards."
108- for i in {1..6}; do
109- if grep -q "http server running" "dashboard.log"; then
110- echo "OpenSearch Dashboards started successfully."
111- break
112- fi
113- if [ $i -eq 6 ]; then
114- echo "Timeout for 60 seconds reached. OpenSearch Dashboards did not start."
115- exit 1
116+ set -euo pipefail
117+ end=$((SECONDS + TIMEOUT))
118+ while (( SECONDS < end )); do
119+ # GET /api/status; treat as ready only when it reports 401/302
120+ if [ "$code" = "401" ] || [ "$code" = "302" ]; then
121+ echo "Server responding (HTTP $code); considering it up."
122+ exit 0
116123 fi
117- sleep 10
124+
125+ sleep "${INTERVAL}"
118126 done
119- shell : bash
120- working-directory : OpenSearch-Dashboards
127+
128+ echo "Timed out after ${TIMEOUT}s waiting for OpenSearch Dashboards status."
129+ echo "Last 200 lines of dashboard.log:"; tail -n 200 dashboard.log || true
130+ exit 1
131+
121132
122133 - name : Run Cypress Tests with retry
123134 uses : Wandalen/wretry.action@v3.3.0
0 commit comments