Skip to content

Commit fc08684

Browse files
authored
Drop this run's test database when the job ends, instead of two days later (#681)
Same omission as home_care_billing PR 1138. Nothing dropped these; infra-ci-db-reap swept them on a 2-day retention, which made a backstop into the primary mechanism - 440 live databases on the CI instance on 2026-08-12, each waiting up to two days for a sweep that only exists because this step did not. The reaper stays, because a cancelled or killed job never reaches its own cleanup step. One drop covers the run: Repo, AdminRepo and HeavyReadRepo all resolve to the same loopctl_test plus MIX_TEST_PARTITION name. if always() because a failed suite strands a database exactly like a passing one, and best-effort so a cleanup problem cannot turn a green run red. The only existing DROP in this workflow is for the scale-test database, which runs on a hosted runner against a service container and was never the one accumulating here.
1 parent 07e77c9 commit fc08684

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,29 @@ jobs:
303303
env:
304304
DATABASE_URL: ecto://postgres:postgres@localhost/loopctl_test
305305

306+
# Drop this run's database the moment the job ends, pass OR fail.
307+
#
308+
# Nothing dropped these. `infra-ci-db-reap` sweeps them on a 2-day retention,
309+
# which made a backstop into the primary mechanism -- 440 live databases on the
310+
# CI instance on 2026-08-12, each waiting up to two days for a sweep that only
311+
# exists because this step did not. There was never a rationale for keeping
312+
# them; it was an omission.
313+
#
314+
# The reaper STAYS: a cancelled or killed job never reaches its own cleanup, so
315+
# end-of-job dropping cannot be the only mechanism. Backstop second, not first.
316+
#
317+
# One database covers all three repos -- Repo, AdminRepo and HeavyReadRepo all
318+
# resolve to `loopctl_test${MIX_TEST_PARTITION}`.
319+
#
320+
# `if: always()` because a FAILED suite strands a database exactly like a
321+
# passing one. Best-effort, so a cleanup problem cannot turn a green run red.
322+
- name: Drop this run's test database
323+
if: always()
324+
run: |
325+
db="loopctl_test${MIX_TEST_PARTITION}"
326+
dropdb --if-exists -h localhost -p "${PGPORT}" -U postgres "$db" 2>&1 || true
327+
echo "cleanup: dropped ${db} (best effort)"
328+
306329
retrieval-eval:
307330
name: Retrieval Eval
308331
runs-on: [self-hosted, beelink]

0 commit comments

Comments
 (0)