diff --git a/Jenkinsfile b/Jenkinsfile index 36a752e5..27996f26 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -239,6 +239,37 @@ pipeline { echo "--- logs: celery_beat ---" docker logs --tail 200 celery_beat 2>&1 || true } + # Postgresql (app) + Alembic antes del resto: evita 10+ min "Waiting" mientras el lifespan + # migra y frontend/celery esperan service_healthy. El start de backend hará "upgrade" idempotente. + echo "== E2E: Postgres (app) + migraciones Antes del resto ==" + if ! e2e_compose build backend; then + e2e_compose_fail_logs + exit 1 + fi + if ! e2e_compose up -d postgres-a76; then + e2e_compose_fail_logs + exit 1 + fi + _pg=0 + while [ "$_pg" -lt 90 ]; do + if e2e_compose exec -T postgres-a76 pg_isready -U postgres -d anexo76_core 2>/dev/null; then + echo "E2E: Postgres (anexo76_core) acepta conexiones" + break + fi + _pg=$((_pg + 1)) + sleep 2 + done + if ! e2e_compose exec -T postgres-a76 pg_isready -U postgres -d anexo76_core 2>/dev/null; then + echo "ERROR: timeout esperando a postgres-a76" + e2e_compose_fail_logs + exit 1 + fi + if ! e2e_compose run --rm --no-deps --entrypoint "" backend sh -c "set -eux; cd /app; alembic upgrade head"; then + echo "ERROR: falló alembic upgrade head (job previo al stack completo)" + e2e_compose_fail_logs + exit 1 + fi + echo "== E2E: stack completo ==" if ! e2e_compose up -d --build; then e2e_compose_fail_logs exit 1