Skip to content

fix(privacy-backup): hold the PostgreSQL and PostGIS packages at the pinned image - #688

Merged
Medformatik merged 1 commit into
mainfrom
fix/privacy-backup-hold-postgis
Oct 30, 2026
Merged

Medformatik merged 1 commit into
mainfrom
fix/privacy-backup-hold-postgis

Conversation

@Medformatik

Copy link
Copy Markdown
Collaborator

What changed and why

CI on main has failed since #687 merged. The cause is not #687. The test (database, export-restore) job builds the privacy-backup collector image fresh, and the retained-backup fixture's restore stopped with BrokenPipeError (re-running gave the same result).

The collector's Dockerfile runs apt-get upgrade -y over the pinned PostGIS image. The PostgreSQL apt repository has now published PostGIS 3.7.0's SQL scripts (postgresql-18-postgis-3-scripts) but not its library, so the upgrade installs mismatched halves:

postgresql-18-postgis-3          3.6.4+dfsg-2.pgdg13+1
postgresql-18-postgis-3-scripts  3.7.0+dfsg-1.pgdg13+1

The dump restore then fails at CREATE EXTENSION postgis:

ERROR:  PostGIS extension scripts version 3.7.0 cannot use older library version 3.6.4

psql (with ON_ERROR_STOP) exits, and the exporter's next write hits the closed pipe. #687 only happened to be the first main build to rebuild that layer after the publish. The same job had passed in #687's PR run and on the previous two main commits.

The Dockerfile already says the restore engine must match the deployment's pinned PostgreSQL/PostGIS image, and the blanket upgrade broke that. The fix:

  • Hold: before upgrading, hold every installed postgresql*, postgis* and libpq* package at the pinned image's version. Other distribution packages still get their security updates; the existing Brotli minimum check still passes.
  • Guard: the build fails if the PostGIS library and script versions ever differ, rather than shipping an image whose every restore fails.
  • Lint: the pipeline runs under bash -o pipefail to satisfy hadolint.

A release built from main now would have shipped the broken collector, since this image is rebuilt whenever its inputs change. The production collector still runs an earlier, matching build.

Verification

  • Reproduction: a --no-cache build of main's Dockerfile has the mismatched packages, and CREATE EXTENSION postgis in it fails with the error above.
  • Fixed build: a --no-cache build with this change holds postgresql-18, libpq5, postgresql-18-postgis-3 and its scripts at the pinned image's versions (18.6, PostGIS 3.6.4), and still upgrades libbrotli1 to 1.1.0-2+deb13u1.
  • Fixture: node services/ops-agent/privacy-backup/test-fixture.mjs, the failing CI step, passes against that image.
  • Lint and policy: hadolint with the repository's configuration passes; its one info note (USER postgres) is unchanged from main. pnpm check:policy, pnpm check-dockerfile-sync, pnpm check-infrastructure and the Docker release-contract tests pass.
  • Not run: an amd64 build. I built on arm64, while CI builds on amd64. The hold and the guard don't depend on architecture, and CI's own job runs the fixture on amd64.

Release and upgrade impact

Product impact: ordinary

No package release: only the privacy-backup collector's Dockerfile changes; neither published package is affected.

…pinned image

apt-get upgrade installed PostGIS 3.7.0's SQL scripts over the 3.6.4
library, which the PostgreSQL repository had not yet published, so every
backup restore failed at CREATE EXTENSION postgis and CI on main broke.
Hold postgresql, postgis and libpq at the pinned image's versions, keep
upgrading everything else, and fail the build if the PostGIS library and
scripts ever differ.
@Medformatik Medformatik added the docker Container images and Docker build or deployment tooling label Oct 30, 2026
@Medformatik Medformatik self-assigned this Oct 30, 2026
@Medformatik
Medformatik merged commit 14505a3 into main Oct 30, 2026
25 checks passed
@Medformatik
Medformatik deleted the fix/privacy-backup-hold-postgis branch October 30, 2026 12:36
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

docker Container images and Docker build or deployment tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant