From e2eba0bacc8073b8333fb707ae38cafea2b34152 Mon Sep 17 00:00:00 2001 From: Giles Odigwe Date: Tue, 28 Apr 2026 16:51:07 -0700 Subject: [PATCH] Add retry logic and port-conflict fix for Ollama CI setup - Kill any auto-started Ollama before launching serve (fixes port conflict: 'address already in use') - Retry ollama pull up to 3 times with 15s backoff (fixes 429 rate limit failures) - Applied to both python-merge-tests.yml and python-integration-tests.yml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/python-integration-tests.yml | 15 +++++++++++++-- .github/workflows/python-merge-tests.yml | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-integration-tests.yml b/.github/workflows/python-integration-tests.yml index 0634c99c1d..a73fb6916b 100644 --- a/.github/workflows/python-integration-tests.yml +++ b/.github/workflows/python-integration-tests.yml @@ -183,6 +183,9 @@ jobs: key: ollama-models-qwen2.5-1.5b-nomic-embed-text-v1 - name: Start Ollama and pull models run: | + # Stop any Ollama instance auto-started by the install script + pkill ollama || true + sleep 2 ollama serve & for i in $(seq 1 30); do if curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then @@ -190,8 +193,16 @@ jobs: fi sleep 1 done - ollama pull qwen2.5:1.5b - ollama pull nomic-embed-text + # Pull models with retry for transient 429 rate limits + for model in qwen2.5:1.5b nomic-embed-text; do + for attempt in 1 2 3; do + if ollama pull "$model"; then + break + fi + echo "Retry $attempt for $model (waiting 15s)..." + sleep 15 + done + done working-directory: . - name: Start local MCP server id: local-mcp diff --git a/.github/workflows/python-merge-tests.yml b/.github/workflows/python-merge-tests.yml index 7a51128b0e..0513f47a2e 100644 --- a/.github/workflows/python-merge-tests.yml +++ b/.github/workflows/python-merge-tests.yml @@ -298,6 +298,9 @@ jobs: key: ollama-models-qwen2.5-1.5b-nomic-embed-text-v1 - name: Start Ollama and pull models run: | + # Stop any Ollama instance auto-started by the install script + pkill ollama || true + sleep 2 ollama serve & for i in $(seq 1 30); do if curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then @@ -305,8 +308,16 @@ jobs: fi sleep 1 done - ollama pull qwen2.5:1.5b - ollama pull nomic-embed-text + # Pull models with retry for transient 429 rate limits + for model in qwen2.5:1.5b nomic-embed-text; do + for attempt in 1 2 3; do + if ollama pull "$model"; then + break + fi + echo "Retry $attempt for $model (waiting 15s)..." + sleep 15 + done + done working-directory: . - name: Start local MCP server id: local-mcp