Skip to content

ci: dump regression.diffs on installcheck failure in the build image#1152

Open
dimitri wants to merge 1 commit into
mainfrom
ci/dump-regression-diffs-on-failure
Open

ci: dump regression.diffs on installcheck failure in the build image#1152
dimitri wants to merge 1 commit into
mainfrom
ci/dump-regression-diffs-on-failure

Conversation

@dimitri

@dimitri dimitri commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

When RUN pg_virtualenv ... make -C src/monitor/ installcheck fails during the Docker build stage, the container running it is discarded on failure — so src/monitor/regression.diffs, the one file that actually shows what differed between expected and actual output, never makes it into the CI log. All CI (and anyone reading it later) gets is the postmaster log tail, which is often noise from unrelated concurrently-registered test fixtures and rarely points at the real cause.

This came up directly while diagnosing recent regress failures on #1149/#1151: pinning down the actual cause required reproducing the build locally and temporarily hacking the Dockerfile to cat the diffs file. That workaround is worth keeping permanently instead of redoing it by hand every time.

Fix

RUN pg_virtualenv -v ${PGVERSION} \
      -o "shared_preload_libraries=pgautofailover" \
      make -C src/monitor/ installcheck || \
      (find src/monitor -name '*.diffs' -exec cat {} +; exit 1)

On failure, find and cat every *.diffs file under src/monitor/ (covers both the REGRESS and ISOLATION suites, wherever pg_regress/pg_isolation_regress happen to write them), then re-raise the original failure so the build still fails exactly as before.

Verified

make build-pg18:

  • Success path (current main) is unaffected — clean build, no output changes.
  • Failure path: deliberately corrupted expected/create_extension.out's output locally, rebuilt, confirmed the diff appears directly in the build log (both in the final failure dump and in buildx's error-context excerpt), then reverted the deliberate corruption.

The build stage's installcheck RUN happens inside an ephemeral Docker
build container: when it fails, that container (and with it
src/monitor/regression.diffs) is discarded, so a CI log only ever
showed the postmaster log tail -- not the actual expected-vs-actual
diff that would explain the failure. Diagnosing recent regress
failures required reproducing locally with a throwaway Dockerfile edit
just to see the diff; this makes that permanent instead.

On failure, find and cat every *.diffs file under src/monitor/ (covers
both the REGRESS and ISOLATION suites, wherever pg_regress/
pg_isolation_regress happen to write them) before re-raising the
original failure.

Verified locally with `make build-pg18`: the success path is unaffected
(clean build, no output changes); deliberately corrupting an expected
file's output shows the diff appears in the build log, both in the
final failure dump and in buildx's error-context excerpt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant