fix(ci): avoid docker subnet exhaustion and harden nightly feed check
Some checks failed
CI / nightly-e2e (pull_request) Has been skipped
CI / ci (pull_request) Failing after 3m40s

This commit is contained in:
Mark
2026-02-28 16:43:20 +00:00
parent 14db1bb57e
commit 29e3589b1a
3 changed files with 26 additions and 29 deletions

View File

@@ -23,8 +23,7 @@ jobs:
- name: Start PostgreSQL - name: Start PostgreSQL
run: | run: |
docker network create ci-net docker run -d --name ci-postgres \
docker run -d --name ci-postgres --network ci-net \
-e POSTGRES_DB=nohype \ -e POSTGRES_DB=nohype \
-e POSTGRES_USER=nohype \ -e POSTGRES_USER=nohype \
-e POSTGRES_PASSWORD=nohype \ -e POSTGRES_PASSWORD=nohype \
@@ -39,22 +38,22 @@ jobs:
exit 1 exit 1
- name: Ruff - name: Ruff
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" ruff check . run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" ruff check .
- name: Mypy - name: Mypy
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" mypy apps config run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" mypy apps config
- name: Pytest - name: Pytest
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" pytest run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" pytest
- name: Tailwind build (assert generated diff is clean) - name: Tailwind build (assert generated diff is clean)
run: | run: |
docker run --rm \ docker run --rm \
--network ci-net \ --network container:ci-postgres \
-v "$PWD:/app" \ -v "$PWD:/app" \
-w /app \ -w /app \
-e SECRET_KEY=ci-secret-key \ -e SECRET_KEY=ci-secret-key \
-e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype \ -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
"$CI_IMAGE" \ "$CI_IMAGE" \
sh -lc "python manage.py tailwind install --no-input && python manage.py tailwind build" sh -lc "python manage.py tailwind install --no-input && python manage.py tailwind build"
git diff --exit-code -- theme/static/css/styles.css git diff --exit-code -- theme/static/css/styles.css
@@ -63,7 +62,6 @@ jobs:
if: always() if: always()
run: | run: |
docker rm -f ci-postgres || true docker rm -f ci-postgres || true
docker network rm ci-net || true
- name: Remove CI image - name: Remove CI image
if: always() if: always()
@@ -80,8 +78,7 @@ jobs:
run: docker build -t "$CI_IMAGE" . run: docker build -t "$CI_IMAGE" .
- name: Start PostgreSQL - name: Start PostgreSQL
run: | run: |
docker network create nightly-net docker run -d --name nightly-postgres \
docker run -d --name nightly-postgres --network nightly-net \
-e POSTGRES_DB=nohype \ -e POSTGRES_DB=nohype \
-e POSTGRES_USER=nohype \ -e POSTGRES_USER=nohype \
-e POSTGRES_PASSWORD=nohype \ -e POSTGRES_PASSWORD=nohype \
@@ -96,9 +93,9 @@ jobs:
exit 1 exit 1
- name: Start dev server with seeded content - name: Start dev server with seeded content
run: | run: |
docker run -d --name nightly-e2e --network nightly-net \ docker run -d --name nightly-e2e --network container:nightly-postgres \
-e SECRET_KEY=ci-secret-key \ -e SECRET_KEY=ci-secret-key \
-e DATABASE_URL=postgres://nohype:nohype@nightly-postgres:5432/nohype \ -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
"$CI_IMAGE" \ "$CI_IMAGE" \
sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000" sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000"
for i in $(seq 1 40); do for i in $(seq 1 40); do
@@ -111,7 +108,7 @@ jobs:
exit 1 exit 1
- name: Run nightly Playwright journey - name: Run nightly Playwright journey
run: | run: |
docker exec nightly-e2e playwright install chromium docker exec nightly-e2e python -m playwright install chromium
docker exec -e E2E_BASE_URL=http://127.0.0.1:8000 nightly-e2e \ docker exec -e E2E_BASE_URL=http://127.0.0.1:8000 nightly-e2e \
pytest -o addopts='' apps/core/tests/test_nightly_e2e_playwright.py -q pytest -o addopts='' apps/core/tests/test_nightly_e2e_playwright.py -q
- name: Remove nightly container - name: Remove nightly container
@@ -119,7 +116,6 @@ jobs:
run: | run: |
docker rm -f nightly-e2e || true docker rm -f nightly-e2e || true
docker rm -f nightly-postgres || true docker rm -f nightly-postgres || true
docker network rm nightly-net || true
- name: Remove CI image - name: Remove CI image
if: always() if: always()
run: docker image rm -f "$CI_IMAGE" || true run: docker image rm -f "$CI_IMAGE" || true

View File

@@ -23,8 +23,7 @@ jobs:
- name: Start PostgreSQL - name: Start PostgreSQL
run: | run: |
docker network create ci-net docker run -d --name ci-postgres \
docker run -d --name ci-postgres --network ci-net \
-e POSTGRES_DB=nohype \ -e POSTGRES_DB=nohype \
-e POSTGRES_USER=nohype \ -e POSTGRES_USER=nohype \
-e POSTGRES_PASSWORD=nohype \ -e POSTGRES_PASSWORD=nohype \
@@ -39,22 +38,22 @@ jobs:
exit 1 exit 1
- name: Ruff - name: Ruff
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" ruff check . run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" ruff check .
- name: Mypy - name: Mypy
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" mypy apps config run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" mypy apps config
- name: Pytest - name: Pytest
run: docker run --rm --network ci-net -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype "$CI_IMAGE" pytest run: docker run --rm --network container:ci-postgres -e SECRET_KEY=ci-secret-key -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype "$CI_IMAGE" pytest
- name: Tailwind build (assert generated diff is clean) - name: Tailwind build (assert generated diff is clean)
run: | run: |
docker run --rm \ docker run --rm \
--network ci-net \ --network container:ci-postgres \
-v "$PWD:/app" \ -v "$PWD:/app" \
-w /app \ -w /app \
-e SECRET_KEY=ci-secret-key \ -e SECRET_KEY=ci-secret-key \
-e DATABASE_URL=postgres://nohype:nohype@ci-postgres:5432/nohype \ -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
"$CI_IMAGE" \ "$CI_IMAGE" \
sh -lc "python manage.py tailwind install --no-input && python manage.py tailwind build" sh -lc "python manage.py tailwind install --no-input && python manage.py tailwind build"
git diff --exit-code -- theme/static/css/styles.css git diff --exit-code -- theme/static/css/styles.css
@@ -63,7 +62,6 @@ jobs:
if: always() if: always()
run: | run: |
docker rm -f ci-postgres || true docker rm -f ci-postgres || true
docker network rm ci-net || true
- name: Remove CI image - name: Remove CI image
if: always() if: always()
@@ -80,8 +78,7 @@ jobs:
run: docker build -t "$CI_IMAGE" . run: docker build -t "$CI_IMAGE" .
- name: Start PostgreSQL - name: Start PostgreSQL
run: | run: |
docker network create nightly-net docker run -d --name nightly-postgres \
docker run -d --name nightly-postgres --network nightly-net \
-e POSTGRES_DB=nohype \ -e POSTGRES_DB=nohype \
-e POSTGRES_USER=nohype \ -e POSTGRES_USER=nohype \
-e POSTGRES_PASSWORD=nohype \ -e POSTGRES_PASSWORD=nohype \
@@ -96,9 +93,9 @@ jobs:
exit 1 exit 1
- name: Start dev server with seeded content - name: Start dev server with seeded content
run: | run: |
docker run -d --name nightly-e2e --network nightly-net \ docker run -d --name nightly-e2e --network container:nightly-postgres \
-e SECRET_KEY=ci-secret-key \ -e SECRET_KEY=ci-secret-key \
-e DATABASE_URL=postgres://nohype:nohype@nightly-postgres:5432/nohype \ -e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
"$CI_IMAGE" \ "$CI_IMAGE" \
sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000" sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000"
for i in $(seq 1 40); do for i in $(seq 1 40); do
@@ -111,7 +108,7 @@ jobs:
exit 1 exit 1
- name: Run nightly Playwright journey - name: Run nightly Playwright journey
run: | run: |
docker exec nightly-e2e playwright install chromium docker exec nightly-e2e python -m playwright install chromium
docker exec -e E2E_BASE_URL=http://127.0.0.1:8000 nightly-e2e \ docker exec -e E2E_BASE_URL=http://127.0.0.1:8000 nightly-e2e \
pytest -o addopts='' apps/core/tests/test_nightly_e2e_playwright.py -q pytest -o addopts='' apps/core/tests/test_nightly_e2e_playwright.py -q
- name: Remove nightly container - name: Remove nightly container
@@ -119,7 +116,6 @@ jobs:
run: | run: |
docker rm -f nightly-e2e || true docker rm -f nightly-e2e || true
docker rm -f nightly-postgres || true docker rm -f nightly-postgres || true
docker network rm nightly-net || true
- name: Remove CI image - name: Remove CI image
if: always() if: always()
run: docker image rm -f "$CI_IMAGE" || true run: docker image rm -f "$CI_IMAGE" || true

View File

@@ -37,6 +37,11 @@ def test_nightly_playwright_journey() -> None:
page.goto(f"{base_url}/feed/", wait_until="networkidle") page.goto(f"{base_url}/feed/", wait_until="networkidle")
feed_content = page.content() feed_content = page.content()
assert "<rss" in feed_content or "<feed" in feed_content assert (
"<rss" in feed_content
or "<feed" in feed_content
or "&lt;rss" in feed_content
or "&lt;feed" in feed_content
)
browser.close() browser.close()