Use per-job network for blackbox services

This commit is contained in:
Daniel Schädler 2026-04-12 09:34:05 +02:00
parent 8c47b270a4
commit 96e80b3375
2 changed files with 19 additions and 6 deletions

View File

@ -35,11 +35,24 @@ rails spec:
rails e2e spec:
stage: test
image: $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA
image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA
services:
- name: postgres:16
alias: postgres
- name: $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA
alias: app
command:
- bundle
- exec
- rails
- s
- -p
- "3000"
- -b
- 0.0.0.0
variables:
FF_NETWORK_PER_BUILD: "true"
CI_DEBUG_SERVICES: "true"
POSTGRES_DB: turniere_blackbox
POSTGRES_USER: turniere
POSTGRES_PASSWORD: turniere
@ -50,9 +63,9 @@ rails e2e spec:
MAILGUN_DOMAIN: blackbox.example.com
RAILS_LOG_TO_STDOUT: "1"
RAILS_SERVE_STATIC_FILES: "1"
NO_PROXY: postgres,localhost,127.0.0.1
no_proxy: postgres,localhost,127.0.0.1
TURNIERE_E2E_BASE_URL: http://127.0.0.1:3000
NO_PROXY: app,postgres,localhost,127.0.0.1
no_proxy: app,postgres,localhost,127.0.0.1
TURNIERE_E2E_BASE_URL: http://app:3000
TURNIERE_E2E_EMAIL: e2e@example.com
TURNIERE_E2E_PASSWORD: password123
TURNIERE_E2E_USERNAME: e2e-user
@ -68,4 +81,4 @@ rails e2e spec:
- when: always
script:
- cd /app
- inv blackbox-self
- inv blackbox-service

View File

@ -24,7 +24,7 @@ Examples:
- `inv docker-test-http-e2e`
The GitLab CI pipeline is expected to use these tasks as well.
In CI, blackbox E2E should run from the production image with Postgres as the sidecar and should avoid Docker Compose inside the job.
In CI, blackbox E2E should prefer the documented GitLab service-to-service model with `FF_NETWORK_PER_BUILD: "true"` when the production image needs to talk to a Postgres sidecar.
The normal Rails spec suite is sharded through `inv test-shard ...` and should stay aligned with the CI matrix configuration.
Useful GitLab push-option variables for saving CI minutes on public repos: