From 87f849dd28ca94a6de3600dcc971857a55f108ab Mon Sep 17 00:00:00 2001 From: anakin87 Date: Wed, 6 Mar 2024 16:09:43 +0100 Subject: [PATCH] add healtcheck with timeout --- .github/workflows/ollama.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index dc4c25967..28b522890 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -41,7 +41,20 @@ jobs: run: | curl -fsSL https://ollama.com/install.sh | sh ollama serve & - sleep 10 + + # Check if the service is up and running with a timeout of 60 seconds + timeout=60 + while [ $timeout -gt 0 ] && ! curl -sSf http://localhost:11434/ > /dev/null; do + echo "Waiting for Ollama service to start..." + sleep 5 + ((timeout-=5)) + done + + if [ $timeout -eq 0 ]; then + echo "Timed out waiting for Ollama service to start." + exit 1 + fi + ollama pull ${{ env.LLM_FOR_TESTS }} ollama pull ${{ env.EMBEDDER_FOR_TESTS }}