ci: stop leaking a 2.8 GB postgres volume every run
deploy / test (push) Successful in 4m43s
deploy / build (push) Successful in 4m0s

`docker rm -f` without -v orphans the anonymous volume the postgres image
declares. cm-testkit creates a database per test, so each CI run left ~2.8 GB
behind: 38 GB of dangling volumes had accumulated on gw-04, most of the 99 GB
-> 23 GB drop in free space over one day.

Note for anyone reaching for `docker volume prune` to clean this up: don't. On
gw-04 the dangling set also contained traefik-acme (Let's Encrypt certificates)
and all three CI cargo caches. Only the anonymous 64-hex volumes were safe to
remove.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-08-13 21:16:38 -07:00
co-authored by Claude Opus 5
parent 25a3d6902a
commit 4d07868410
+6 -2
View File
@@ -37,7 +37,7 @@ jobs:
# only means "no database here".
- name: Start test Postgres
run: |
docker rm -f cm-ci-pg 2>/dev/null || true
docker rm -fv cm-ci-pg 2>/dev/null || true
docker run -d --name cm-ci-pg \
-e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres \
-p 127.0.0.1:55432:5432 postgres:16-alpine
@@ -93,9 +93,13 @@ jobs:
git config --global url."https://oauth2:[email protected]/".insteadOf "https://git.redclaw.dev/"
cargo test --workspace'
# -v, not just -f. The postgres image declares a VOLUME, so removing the
# container without it orphans an anonymous data directory EVERY run.
# cm-testkit creates a database per test, so those grew to 2.8 GB each —
# 38 GB of leaked volumes before anyone noticed.
- name: Stop test Postgres
if: always()
run: docker rm -f cm-ci-pg 2>/dev/null || true
run: docker rm -fv cm-ci-pg 2>/dev/null || true
# node 22 is on the host, so these run directly.
- name: Frontend checks