Skip to content

Commit 1c3d776

Browse files
fix(release): declare the inventory schema version the release gate requires (#1685)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent dbf0d4e commit 1c3d776

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

scripts/check-release-image-inventory.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ await test("repository release builds are covered by the evidence inventory", ()
99
assert.deepEqual(validateInventory(inventory, workflow), []);
1010
});
1111

12+
await test("the shipped inventory declares the schema version the release validator requires", () => {
13+
const inventory: unknown = JSON.parse(readFileSync("security/release-images.json", "utf8"));
14+
assert.ok(typeof inventory === "object" && inventory !== null && "schemaVersion" in inventory);
15+
assert.equal(inventory.schemaVersion, 1);
16+
});
17+
1218
await test("rejects missing and duplicate inventory entries", () => {
1319
assert.deepEqual(
1420
validateInventory({ images: ["server"], upstream: [] }, 'image-name: "hephaestus-build/new"'),

scripts/check-release-image-inventory.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ if (import.meta.main) {
5858
!Array.isArray(inventory.upstream)
5959
)
6060
throw new Error("malformed upstream image inventory");
61+
// The release-time validator in verify-release-evidence.ts rejects an inventory
62+
// without schemaVersion 1. Assert it here too, where every pull request runs:
63+
// otherwise the mismatch only surfaces mid-release, after the tag is cut.
64+
if (!("schemaVersion" in inventory) || inventory.schemaVersion !== 1)
65+
throw new Error("release image inventory must declare schemaVersion 1");
6166
const compose = [
6267
"docker/compose.app.yaml",
6368
"docker/compose.core.yaml",

security/release-images.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"images": ["webapp", "application-server", "agent-pi", "postgres"],
2+
"schemaVersion": 1,
3+
"images": [
4+
"webapp",
5+
"application-server",
6+
"agent-pi",
7+
"postgres"
8+
],
39
"upstream": [
410
{
511
"name": "alpine",

0 commit comments

Comments
 (0)