From ae076e194afe2595874353e28f03969d7176b8d4 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Mon, 25 May 2026 14:08:45 -0500 Subject: [PATCH] fix(ci): avoid postgres service collision in k8s backend --- .woodpecker/ci.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.woodpecker/ci.yml b/.woodpecker/ci.yml index aaf47db..07484b7 100644 --- a/.woodpecker/ci.yml +++ b/.woodpecker/ci.yml @@ -46,18 +46,28 @@ steps: test: image: *node_image environment: - DATABASE_URL: postgresql://mosaic:mosaic@postgres:5432/mosaic + # Avoid the namespace-level Woodpecker DB service named "postgres". + # The Kubernetes backend exposes service containers by step name. + DATABASE_URL: postgresql://mosaic:mosaic@ci-postgres:5432/mosaic commands: - *enable_pnpm # Install postgresql-client for pg_isready - apk add --no-cache postgresql-client - # Wait up to 30s for postgres to be ready + # Wait up to 60s for CI postgres to be ready; fail fast if it never comes up. - | - for i in $(seq 1 30); do - pg_isready -h postgres -p 5432 -U mosaic && break - echo "Waiting for postgres ($i/30)..." + ready=0 + for i in $(seq 1 60); do + if pg_isready -h ci-postgres -p 5432 -U mosaic; then + ready=1 + break + fi + echo "Waiting for ci-postgres ($i/60)..." sleep 1 done + if [ "$ready" -ne 1 ]; then + echo "ci-postgres did not become ready" >&2 + exit 1 + fi # Run migrations (DATABASE_URL is set in environment above) - pnpm --filter @mosaicstack/db run db:migrate # Run all tests @@ -66,7 +76,7 @@ steps: - typecheck services: - postgres: + ci-postgres: image: pgvector/pgvector:pg17 environment: POSTGRES_USER: mosaic