Skip to content

ci: extract duplicated PG readiness wait into helper #361

Description

@NikolayS

Follow-up from the review of #286. Non-blocking; #286 intentionally kept the fix consistent with the existing per-job copies.

The PostgreSQL readiness wait (ready=0 flag loop + timeout diagnostic + docker logs dump) is duplicated across roughly eight jobs in .github/workflows/ci.yml, differing only in the container name. The original bug #286 fixed (a dead || { ...; exit 1; } branch) spread to four jobs precisely because this logic was copy-pasted; eight divergent copies invite the same drift the next time the wait logic changes.

Extract the wait into a single parameterized helper invoked from each job — either:

  • scripts/wait-for-pg.sh <container> [timeout_seconds] (shell style per CLAUDE.md: set -Eeuo pipefail, 2-space indent, quoted expansions), or
  • a composite action with a container input.

All jobs should call the shared helper; behavior (30 s timeout, diagnostic message, docker logs on failure) stays identical. Verify by stubbing docker locally for both the success and never-ready paths, as done in #286's PR body.

Origin: review comment on #286. Related: #283 finding D1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions