Skip to content

Commit e54f0ca

Browse files
committed
test(cli): pin the runtime and build image maps to matching tag pairs
1 parent f0aacf5 commit e54f0ca

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

packages/cli-v3/src/deploy/buildImage.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { join } from "node:path";
33
import { fileURLToPath } from "node:url";
44
import type { BuildRuntime } from "@trigger.dev/core/v3/schemas";
55
import { describe, expect, it } from "vitest";
6-
import { DEFAULT_PACKAGES, TOOLCHAIN_PACKAGES, generateContainerfile } from "./buildImage.js";
6+
import {
7+
BASE_IMAGE,
8+
BUILD_IMAGE,
9+
DEFAULT_PACKAGES,
10+
TOOLCHAIN_PACKAGES,
11+
generateContainerfile,
12+
} from "./buildImage.js";
713

814
const images: Array<[BuildRuntime, string, string]> = [
915
[
@@ -53,6 +59,17 @@ describe("generateContainerfile", () => {
5359
}
5460
);
5561

62+
it("pairs every runtime image with its -build variant", () => {
63+
for (const runtime of Object.keys(BASE_IMAGE) as BuildRuntime[]) {
64+
const baseRef = BASE_IMAGE[runtime].split("@")[0];
65+
const buildRef = BUILD_IMAGE[runtime].split("@")[0];
66+
67+
expect(buildRef).toBe(`${baseRef}-build`);
68+
expect(BASE_IMAGE[runtime]).toMatch(/@sha256:[a-f0-9]{64}$/);
69+
expect(BUILD_IMAGE[runtime]).toMatch(/@sha256:[a-f0-9]{64}$/);
70+
}
71+
});
72+
5673
it("matches the published base image package lists", () => {
5774
const imagesJson = JSON.parse(
5875
readFileSync(

packages/cli-v3/src/deploy/buildImage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ export type GenerateContainerfileOptions = {
688688
};
689689

690690
// Prebuilt in base-images/; both maps must be bumped together, from one publish run
691-
const BASE_IMAGE: Record<BuildRuntime, string> = {
691+
export const BASE_IMAGE: Record<BuildRuntime, string> = {
692692
bun: "triggerdotdev/bun:1.3-node20-bookworm@sha256:61d0f681429e69a0eb0eb054c6dbbc5876012feebabf012dd9b80e2f3f776771",
693693
node: "triggerdotdev/node:21-bookworm@sha256:2580fbfa9a1f75d53126d98bb4bbafabaf3db6b7c1b7996b6603dbea0efcd88c",
694694
"node-22":
@@ -699,7 +699,7 @@ const BASE_IMAGE: Record<BuildRuntime, string> = {
699699
"triggerdotdev/node:26-bookworm@sha256:04420c0cb9bd1890fe9dd51fcdfd0a263276e76c5fe088b175a943ccbab36b2a",
700700
};
701701

702-
const BUILD_IMAGE: Record<BuildRuntime, string> = {
702+
export const BUILD_IMAGE: Record<BuildRuntime, string> = {
703703
bun: "triggerdotdev/bun:1.3-node20-bookworm-build@sha256:fdd8dcaf4d0370f9571156d8c71c4b91c0cd02bb49850e0019e3e233fe1b35e1",
704704
node: "triggerdotdev/node:21-bookworm-build@sha256:39e1d485e759280c4935f14ee5b31fdfc322b3d246d631abada11fd9734e0ae1",
705705
"node-22":

0 commit comments

Comments
 (0)