From 3313ec474a525e22c69d51f8ade6155024c75833 Mon Sep 17 00:00:00 2001 From: Pyronewbic Date: Mon, 18 May 2026 16:26:06 +0530 Subject: [PATCH 1/2] fix: clean exit in test-api-local.sh (wait || true) --- scripts/test-api-local.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/test-api-local.sh b/scripts/test-api-local.sh index 427742c..2a3ccb0 100755 --- a/scripts/test-api-local.sh +++ b/scripts/test-api-local.sh @@ -4,17 +4,14 @@ set -e PORT=3033 cleanup() { - echo "Cleaning up..." [ -n "$SERVER_PID" ] && kill $SERVER_PID 2>/dev/null - wait $SERVER_PID 2>/dev/null - echo "Done." + wait $SERVER_PID 2>/dev/null || true } trap cleanup EXIT echo "Starting API server on :$PORT..." API_PORT=$PORT node api.js 2>/dev/null & SERVER_PID=$! -SERVER_PID=$! echo "Waiting for server..." for i in $(seq 1 15); do From 6c909fa2c215ddd55d04a5408ea905e4f11ecad5 Mon Sep 17 00:00:00 2001 From: Pyronewbic Date: Mon, 18 May 2026 16:28:53 +0530 Subject: [PATCH 2/2] ci: post-deploy health check on both regions - After deploying to each region, verify /api/health returns ok - Retries up to 10 times with 5s intervals (handles cold starts) - Fails the deploy job if health check doesn't pass --- .github/workflows/deploy.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ab1b358..0bcd249 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -116,3 +116,22 @@ jobs: --project ${{ env.PROJECT_ID }} \ --port 3000 \ --allow-unauthenticated + + - name: Health check (${{ matrix.region }}) + run: | + URL=$(gcloud run services describe ${{ env.SERVICE }} \ + --region ${{ matrix.region }} \ + --project ${{ env.PROJECT_ID }} \ + --format='value(status.url)') + echo "Checking $URL/api/health..." + for i in $(seq 1 10); do + STATUS=$(curl -sf "$URL/api/health" | python3 -c "import sys,json; print(json.load(sys.stdin).get('status',''))" 2>/dev/null) + if [ "$STATUS" = "ok" ]; then + echo "Healthy (attempt $i)" + exit 0 + fi + echo " attempt $i: $STATUS" + sleep 5 + done + echo "Health check failed after 10 attempts" + exit 1