fix(ci): avoid postgres service collision in k8s backend

This commit is contained in:
Jarvis
2026-05-25 14:08:45 -05:00
parent 7864e0b3b3
commit ae076e194a

View File

@@ -46,18 +46,28 @@ steps:
test: test:
image: *node_image image: *node_image
environment: 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: commands:
- *enable_pnpm - *enable_pnpm
# Install postgresql-client for pg_isready # Install postgresql-client for pg_isready
- apk add --no-cache postgresql-client - 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 ready=0
pg_isready -h postgres -p 5432 -U mosaic && break for i in $(seq 1 60); do
echo "Waiting for postgres ($i/30)..." if pg_isready -h ci-postgres -p 5432 -U mosaic; then
ready=1
break
fi
echo "Waiting for ci-postgres ($i/60)..."
sleep 1 sleep 1
done 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) # Run migrations (DATABASE_URL is set in environment above)
- pnpm --filter @mosaicstack/db run db:migrate - pnpm --filter @mosaicstack/db run db:migrate
# Run all tests # Run all tests
@@ -66,7 +76,7 @@ steps:
- typecheck - typecheck
services: services:
postgres: ci-postgres:
image: pgvector/pgvector:pg17 image: pgvector/pgvector:pg17
environment: environment:
POSTGRES_USER: mosaic POSTGRES_USER: mosaic