test: guard production metadata cache ordering
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
3d3cc4941a
commit
672da3f079
|
|
@ -35,6 +35,25 @@ function stageBody(source: string, stageName: string): string {
|
|||
return source.slice(start, end);
|
||||
}
|
||||
|
||||
it("keeps per-build runtime metadata out of the weekly CLI-install cache", () => {
|
||||
const production = stageBody(dockerfile, "production");
|
||||
const tools = production.search(/^RUN echo "cli-tools-epoch:/m);
|
||||
const entrypoint = production.search(/^RUN chmod \+x \/usr\/local\/bin\/docker-entrypoint\.sh/m);
|
||||
const runtime = production.search(/^ENV NODE_ENV=production/m);
|
||||
const epoch = production.search(/^ARG CLI_TOOLS_CACHE_EPOCH\b/m);
|
||||
expect(tools).toBeGreaterThanOrEqual(0);
|
||||
expect(entrypoint).toBeGreaterThan(tools);
|
||||
expect(epoch).toBeGreaterThanOrEqual(0);
|
||||
expect(epoch).toBeLessThan(tools);
|
||||
for (const name of ["PAPERCLIP_BUILD_VERSION", "PAPERCLIP_BUILD_COMMIT"]) {
|
||||
const declarations = [...production.matchAll(new RegExp(`^ARG ${name}\\b`, "gm"))];
|
||||
expect(declarations).toHaveLength(1);
|
||||
expect(declarations[0].index).toBeGreaterThan(entrypoint);
|
||||
expect(declarations[0].index).toBeLessThan(runtime);
|
||||
expect(production.slice(runtime)).toContain(`${name}=\${${name}}`);
|
||||
}
|
||||
});
|
||||
|
||||
describe("docker build-stamp wiring", () => {
|
||||
it("declares PAPERCLIP_BUILD_COMMIT in the build stage before the server build", () => {
|
||||
const build = stageBody(dockerfile, "build");
|
||||
|
|
|
|||
Loading…
Reference in New Issue