From b309a4e0a3b47411d75308bb9088f1af56b0be9c Mon Sep 17 00:00:00 2001 From: jakeross Date: Fri, 21 Aug 2026 08:40:33 -0700 Subject: [PATCH] ci(cypress): stop waiting on an API container that already died MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The readiness probe polled http://localhost:8000/docs for a flat 720s. When the API aborts during startup — as it does when its development seed fails — nothing was ever going to answer, so the job burned twelve minutes before `timeout` killed it with exit 124 and no useful output. Check whether the app container is still running between polls and bail out immediately with its logs when it is not. A startup failure now surfaces in seconds instead of the readiness probe hiding it, and the overall budget drops from 720s to 180s of genuine waiting. --- .github/workflows/CI_cypress.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI_cypress.yml b/.github/workflows/CI_cypress.yml index 827bb11d..7e89131a 100644 --- a/.github/workflows/CI_cypress.yml +++ b/.github/workflows/CI_cypress.yml @@ -80,17 +80,28 @@ jobs: working-directory: ./api-repo run: docker compose logs --tail=200 app || true + # Give up as soon as the app container dies. Polling a container that has + # already exited used to burn the full timeout before the job failed. - name: Wait for FastAPI to be ready working-directory: ./api-repo run: | echo "Waiting for FastAPI to be ready..." - timeout 720 bash -c ' - until curl -sf http://localhost:8000/docs; do - echo "FastAPI not up yet, retrying..." - sleep 3 - done - ' - echo "FastAPI is up and healthy" + for _ in $(seq 1 60); do + if curl -sf http://localhost:8000/docs >/dev/null; then + echo "FastAPI is up and healthy" + exit 0 + fi + if [ -z "$(docker compose ps --status running -q app)" ]; then + echo "The app container stopped before serving requests:" + docker compose logs --tail=100 app + exit 1 + fi + echo "FastAPI not up yet, retrying..." + sleep 3 + done + echo "FastAPI did not become ready within 180s:" + docker compose logs --tail=100 app + exit 1 - name: Show API logs after readiness probe if: always()