mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
Merge pull request #988 from MBombeck/chore/postgres-minor-watch
chore(deps): move the database pin to 16.15 and watch it
This commit is contained in:
3 files changed
+68
-1
No files matched your search
@@ -29,3 +29,12 @@ updates:
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 3
|
||||
# The `docker` ecosystem above reads the Dockerfile only. The bundled
|
||||
# database lives in `docker-compose.yml`, which GitHub treats as its own
|
||||
# ecosystem, so without this block a new PostgreSQL minor release never
|
||||
# reaches us and the pin ages silently.
|
||||
- package-ecosystem: "docker-compose"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 3
|
||||
+10
-1
@@ -482,7 +482,16 @@ services:
|
||||
# existing deployments see no image change). Minor releases share
|
||||
# the on-disk format — bumping this pin is safe without a dump /
|
||||
# restore; a major-version bump (17+) is not.
|
||||
image: postgres:16.14-alpine
|
||||
#
|
||||
# The pin only works as long as something watches it: PostgreSQL
|
||||
# publishes minor releases with security and data-corruption fixes and
|
||||
# recommends running the current one, and this line sat two minors
|
||||
# behind for five weeks because the Dockerfile was the only thing
|
||||
# Dependabot looked at. The `docker-compose` ecosystem in
|
||||
# `.github/dependabot.yml` now raises a PR for each new minor;
|
||||
# `src/__tests__/database-pin-is-watched.test.ts` keeps both halves
|
||||
# (concrete pin, active watch) from being dropped.
|
||||
image: postgres:16.15-alpine
|
||||
container_name: healthlog-db
|
||||
# cap_drop: [ALL] is deliberately NOT applied here (unlike `app`): the
|
||||
# official Postgres entrypoint starts as root, chowns the data
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
/**
|
||||
* The bundled database is pinned to an exact minor, AND something watches it.
|
||||
*
|
||||
* Both halves matter and only together. The pin exists so a database change is
|
||||
* a deliberate, reviewable one rather than whatever the registry happens to
|
||||
* serve on the day an operator pulls. But PostgreSQL ships security and
|
||||
* data-corruption fixes in minor releases and recommends running the current
|
||||
* one, so a pin nobody moves ships a knowingly outdated database: this line
|
||||
* sat on 16.14 for five weeks after 16.15 was published, because the
|
||||
* `docker` ecosystem Dependabot was configured with reads the Dockerfile and
|
||||
* never looks at a compose file.
|
||||
*
|
||||
* So: drop the pin and the deliberate-update model goes; drop the watch and
|
||||
* the pin ages in silence. This test fails on either.
|
||||
*/
|
||||
|
||||
const ROOT = resolve(__dirname, "../..");
|
||||
|
||||
function read(relative: string): string {
|
||||
return readFileSync(resolve(ROOT, relative), "utf8");
|
||||
}
|
||||
|
||||
describe("the bundled database pin", () => {
|
||||
it("names an exact minor version, not a floating major alias", () => {
|
||||
const images = [
|
||||
...read("docker-compose.yml").matchAll(/^\s*image:\s*(postgres:\S+)/gm),
|
||||
].map((match) => match[1]);
|
||||
|
||||
expect(images.length).toBe(1);
|
||||
// `postgres:16-alpine` or `postgres:16` would match a moving target.
|
||||
expect(images[0]).toMatch(/^postgres:\d+\.\d+-alpine$/);
|
||||
});
|
||||
|
||||
it("is watched by the compose ecosystem, which is not the Dockerfile one", () => {
|
||||
const dependabot = read(".github/dependabot.yml");
|
||||
const ecosystems = [
|
||||
...dependabot.matchAll(/package-ecosystem:\s*"([^"]+)"/g),
|
||||
].map((match) => match[1]);
|
||||
|
||||
expect(ecosystems).toContain("docker-compose");
|
||||
// The Dockerfile watch is a separate entry and does not stand in for it.
|
||||
expect(ecosystems).toContain("docker");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user