From d612dce6bb9e4041e9c05f78140b7e8982cd5f6f Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Wed, 19 Aug 2026 18:53:05 -0300 Subject: [PATCH] =?UTF-8?q?fix(OPS71):=20services=20Postgres=20por=20porta?= =?UTF-8?q?=20publicada=20no=20localhost=20(jobs=20hosted=20rodam=20na=20V?= =?UTF-8?q?M,=20n=C3=A3o=20na=20rede=20do=20job)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-pr.yml | 33 +++++++++++++++------------------ .github/workflows/deploy.yml | 19 ++++++++++++------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 3838b057..b8849ca6 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -25,10 +25,12 @@ # a fork PR would burn hosted minutes running arbitrary code. Same guard class # as the RCE guard on the post-merge workflows. # -# Postgres services live on the job network and are reached by NAME -# (postgres-int / postgres-build on 5432) — no host publish, so concurrent -# runs never collide on host ports. Two isolated services keep e2e from -# inheriting int fixture residue. +# Postgres services (OPS71 — GitHub hosted): jobs run directly on the runner +# VM (NOT inside the job-container network of the Forgejo era), so services +# are reached at localhost on PUBLISHED host ports. Each hosted run is its own +# VM, so fixed ports never collide across runs. Two isolated services — int +# on 5432 and build+e2e on 5433 — keep e2e from inheriting int fixture +# residue. name: CI (PR) on: @@ -52,16 +54,14 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 50 services: - # Services are reached by NAME on the job network (no host publish): - # concurrent runs never collide on host ports, which the single - # long-lived job would hold for the whole run. Two isolated services — - # int and build+e2e — keep e2e from inheriting int fixture residue. postgres-int: image: postgres:17-alpine env: POSTGRES_USER: teqo POSTGRES_PASSWORD: teqo POSTGRES_DB: teqo_test + ports: + - 5432:5432 options: >- --health-cmd "pg_isready -U teqo" --health-interval 5s @@ -73,6 +73,8 @@ jobs: POSTGRES_USER: teqo POSTGRES_PASSWORD: teqo POSTGRES_DB: teqo_test + ports: + - 5433:5432 options: >- --health-cmd "pg_isready -U teqo" --health-interval 5s @@ -147,16 +149,11 @@ jobs: - name: Prepare database URL (int service) run: | set -euo pipefail - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-int:5432/teqo_test" >> "$GITHUB_ENV" + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test" >> "$GITHUB_ENV" # vitest re-loads .env.test over the process env, so the service URL # must win through the .env.test.local layer (same mechanism - # `pnpm worktree next` uses). OPS50. - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-int:5432/teqo_test" > .env.test.local - - name: Debug service DNS (temporary diagnostic) - run: | - getent hosts postgres-int || echo "getent postgres-int: unresolved" - getent hosts postgres-build || echo "getent postgres-build: unresolved" - node -e "require('node:dns').lookup('postgres-int', (e, a) => console.log('node lookup postgres-int:', e ? e.code : a))" + # `pnpm worktree next` uses). + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test" > .env.test.local - name: Migrate (int database) run: pnpm migrate - name: Seed minimal (int database) @@ -181,8 +178,8 @@ jobs: if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none' run: | set -euo pipefail - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" >> "$GITHUB_ENV" - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" > .env.test.local + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/teqo_test" >> "$GITHUB_ENV" + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/teqo_test" > .env.test.local - name: Migrate (build/e2e database) if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none' run: pnpm migrate diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c6f4961b..5463c715 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -41,15 +41,18 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 50 services: - # Services are reached by NAME on the job network (no host publish). - # Two isolated services — int and build+e2e — keep e2e from inheriting - # int fixture residue. + # OPS71 — GitHub hosted: jobs run on the runner VM, so services are + # reached at localhost on PUBLISHED host ports (fixed — each run is its + # own VM). Two isolated services — int on 5432, build+e2e on 5433 — + # keep e2e from inheriting int fixture residue. postgres-int: image: postgres:17-alpine env: POSTGRES_USER: teqo POSTGRES_PASSWORD: teqo POSTGRES_DB: teqo_test + ports: + - 5432:5432 options: >- --health-cmd "pg_isready -U teqo" --health-interval 5s @@ -61,6 +64,8 @@ jobs: POSTGRES_USER: teqo POSTGRES_PASSWORD: teqo POSTGRES_DB: teqo_test + ports: + - 5433:5432 options: >- --health-cmd "pg_isready -U teqo" --health-interval 5s @@ -95,11 +100,11 @@ jobs: - name: Prepare database URL (int service) run: | set -euo pipefail - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-int:5432/teqo_test" >> "$GITHUB_ENV" + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test" >> "$GITHUB_ENV" # vitest re-loads .env.test over the process env, so the service URL # must win through the .env.test.local layer (same mechanism # `pnpm worktree next` uses). - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-int:5432/teqo_test" > .env.test.local + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo_test" > .env.test.local - name: Migrate (int database) run: pnpm migrate - name: Seed minimal (int database) @@ -115,8 +120,8 @@ jobs: - name: Prepare database URL (build/e2e service) run: | set -euo pipefail - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" >> "$GITHUB_ENV" - echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" > .env.test.local + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/teqo_test" >> "$GITHUB_ENV" + echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/teqo_test" > .env.test.local - name: Migrate (build/e2e database) run: pnpm migrate - name: Seed minimal (build/e2e database)