Skip to content

Commit 972423f

Browse files
committed
wait
1 parent ed297d7 commit 972423f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/cicd.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ jobs:
9898
run: |
9999
pip install pytest-timeout
100100
101+
- name: Wait for OpenSearch to be ready
102+
run: |
103+
set -e
104+
host="${{ env.OPENSEARCH_HOST:-localhost }}"
105+
port="${{ env.OPENSEARCH_PORT:-9202 }}"
106+
url="http://$host:$port/_cluster/health"
107+
echo "Waiting for OpenSearch at $url"
108+
for i in $(seq 1 60); do
109+
if curl -sS "$url" | grep -E '"status":"(yellow|green)"' >/dev/null 2>&1; then
110+
echo "OpenSearch is ready"
111+
curl -sS "http://$host:$port" || true
112+
break
113+
fi
114+
echo "OpenSearch not ready yet ($i/60) — sleeping 5s"
115+
sleep 5
116+
done
117+
# Final check: fail the job if still not ready
118+
if ! curl -sS "$url" | grep -E '"status":"(yellow|green)"' >/dev/null 2>&1; then
119+
echo "OpenSearch failed to become ready within timeout"
120+
curl -sS "http://$host:$port" || true
121+
exit 1
122+
fi
123+
101124
- name: Debug OpenSearch/Elasticsearch status
102125
run: |
103126
echo "Root response:"

0 commit comments

Comments
 (0)