fix: minimize deploy cutover downtime
CI / check (push) Successful in 22s
CI / release (push) Skipped
CI / deploy (push) Successful in 40s

This commit is contained in:
Simo committed 2026-08-02 11:25:03 +02:00
1 parent 828fda63e7
commit bfc951cfd9
2 files changed
+34 -25

No files matched your search

+9 -1
View File
@@ -75,10 +75,15 @@ describe("production deploy workflow", () => {
expect(
toContainLiteral(deployJob, `mv "${stageVar}/node_modules" node_modules`),
).toBe(true);
expect(deployJob).toContain("mv node_modules node_modules.prev");
expect(deployJob).toContain("Rolling back .next to previous artifact");
expect(deployJob).toContain(
"Rolling back node_modules to previous artifact",
);
const buildAt = deployJob.indexOf("pnpm build");
const stopAt = deployJob.indexOf("pm2 stop next");
const migrateAt = deployJob.indexOf("pnpm db:migrate");
const resetAt = deployJob.indexOf("git reset --hard origin/main");
const startLabelAt = deployJob.indexOf("Starting PM2");
const startAt = deployJob.indexOf(
"pm2 start pnpm --name next -- start",
@@ -86,9 +91,12 @@ describe("production deploy workflow", () => {
);
expect(buildAt).toBeGreaterThan(-1);
expect(migrateAt).toBeGreaterThan(buildAt);
expect(stopAt).toBeGreaterThan(migrateAt);
expect(resetAt).toBeGreaterThan(migrateAt);
expect(stopAt).toBeGreaterThan(resetAt);
expect(startLabelAt).toBeGreaterThan(stopAt);
expect(startAt).toBeGreaterThan(startLabelAt);
expect(deployJob.match(/pm2 stop next/g)).toHaveLength(1);
expect(deployJob.slice(stopAt, startAt)).not.toContain("sleep ");
});
it("does not restart the healthy app when deployment fails before cutover", () => {