mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-24 09:03:11 +00:00
fix(OPS71): services Postgres por porta publicada no localhost (jobs hosted rodam na VM, não na rede do job)
This commit is contained in:
parent
5ec5368ef6
commit
d612dce6bb
2 changed files with 27 additions and 25 deletions
33
.github/workflows/ci-pr.yml
vendored
33
.github/workflows/ci-pr.yml
vendored
|
|
@ -25,10 +25,12 @@
|
||||||
# a fork PR would burn hosted minutes running arbitrary code. Same guard class
|
# a fork PR would burn hosted minutes running arbitrary code. Same guard class
|
||||||
# as the RCE guard on the post-merge workflows.
|
# as the RCE guard on the post-merge workflows.
|
||||||
#
|
#
|
||||||
# Postgres services live on the job network and are reached by NAME
|
# Postgres services (OPS71 — GitHub hosted): jobs run directly on the runner
|
||||||
# (postgres-int / postgres-build on 5432) — no host publish, so concurrent
|
# VM (NOT inside the job-container network of the Forgejo era), so services
|
||||||
# runs never collide on host ports. Two isolated services keep e2e from
|
# are reached at localhost on PUBLISHED host ports. Each hosted run is its own
|
||||||
# inheriting int fixture residue.
|
# 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)
|
name: CI (PR)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -52,16 +54,14 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
services:
|
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:
|
postgres-int:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: teqo
|
POSTGRES_USER: teqo
|
||||||
POSTGRES_PASSWORD: teqo
|
POSTGRES_PASSWORD: teqo
|
||||||
POSTGRES_DB: teqo_test
|
POSTGRES_DB: teqo_test
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U teqo"
|
--health-cmd "pg_isready -U teqo"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
|
|
@ -73,6 +73,8 @@ jobs:
|
||||||
POSTGRES_USER: teqo
|
POSTGRES_USER: teqo
|
||||||
POSTGRES_PASSWORD: teqo
|
POSTGRES_PASSWORD: teqo
|
||||||
POSTGRES_DB: teqo_test
|
POSTGRES_DB: teqo_test
|
||||||
|
ports:
|
||||||
|
- 5433:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U teqo"
|
--health-cmd "pg_isready -U teqo"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
|
|
@ -147,16 +149,11 @@ jobs:
|
||||||
- name: Prepare database URL (int service)
|
- name: Prepare database URL (int service)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
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
|
# vitest re-loads .env.test over the process env, so the service URL
|
||||||
# must win through the .env.test.local layer (same mechanism
|
# must win through the .env.test.local layer (same mechanism
|
||||||
# `pnpm worktree next` uses). OPS50.
|
# `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: 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))"
|
|
||||||
- name: Migrate (int database)
|
- name: Migrate (int database)
|
||||||
run: pnpm migrate
|
run: pnpm migrate
|
||||||
- name: Seed minimal (int database)
|
- name: Seed minimal (int database)
|
||||||
|
|
@ -181,8 +178,8 @@ jobs:
|
||||||
if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none'
|
if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none'
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" >> "$GITHUB_ENV"
|
echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/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" > .env.test.local
|
||||||
- name: Migrate (build/e2e database)
|
- name: Migrate (build/e2e database)
|
||||||
if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none'
|
if: steps.scope.outputs.build_mode != 'none' || steps.scope.outputs.e2e_mode != 'none'
|
||||||
run: pnpm migrate
|
run: pnpm migrate
|
||||||
|
|
|
||||||
19
.github/workflows/deploy.yml
vendored
19
.github/workflows/deploy.yml
vendored
|
|
@ -41,15 +41,18 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
services:
|
services:
|
||||||
# Services are reached by NAME on the job network (no host publish).
|
# OPS71 — GitHub hosted: jobs run on the runner VM, so services are
|
||||||
# Two isolated services — int and build+e2e — keep e2e from inheriting
|
# reached at localhost on PUBLISHED host ports (fixed — each run is its
|
||||||
# int fixture residue.
|
# own VM). Two isolated services — int on 5432, build+e2e on 5433 —
|
||||||
|
# keep e2e from inheriting int fixture residue.
|
||||||
postgres-int:
|
postgres-int:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: teqo
|
POSTGRES_USER: teqo
|
||||||
POSTGRES_PASSWORD: teqo
|
POSTGRES_PASSWORD: teqo
|
||||||
POSTGRES_DB: teqo_test
|
POSTGRES_DB: teqo_test
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U teqo"
|
--health-cmd "pg_isready -U teqo"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
|
|
@ -61,6 +64,8 @@ jobs:
|
||||||
POSTGRES_USER: teqo
|
POSTGRES_USER: teqo
|
||||||
POSTGRES_PASSWORD: teqo
|
POSTGRES_PASSWORD: teqo
|
||||||
POSTGRES_DB: teqo_test
|
POSTGRES_DB: teqo_test
|
||||||
|
ports:
|
||||||
|
- 5433:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U teqo"
|
--health-cmd "pg_isready -U teqo"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
|
|
@ -95,11 +100,11 @@ jobs:
|
||||||
- name: Prepare database URL (int service)
|
- name: Prepare database URL (int service)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
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
|
# vitest re-loads .env.test over the process env, so the service URL
|
||||||
# must win through the .env.test.local layer (same mechanism
|
# must win through the .env.test.local layer (same mechanism
|
||||||
# `pnpm worktree next` uses).
|
# `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)
|
- name: Migrate (int database)
|
||||||
run: pnpm migrate
|
run: pnpm migrate
|
||||||
- name: Seed minimal (int database)
|
- name: Seed minimal (int database)
|
||||||
|
|
@ -115,8 +120,8 @@ jobs:
|
||||||
- name: Prepare database URL (build/e2e service)
|
- name: Prepare database URL (build/e2e service)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "DATABASE_URL=postgresql://teqo:teqo@postgres-build:5432/teqo_test" >> "$GITHUB_ENV"
|
echo "DATABASE_URL=postgresql://teqo:teqo@localhost:5433/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" > .env.test.local
|
||||||
- name: Migrate (build/e2e database)
|
- name: Migrate (build/e2e database)
|
||||||
run: pnpm migrate
|
run: pnpm migrate
|
||||||
- name: Seed minimal (build/e2e database)
|
- name: Seed minimal (build/e2e database)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue