fix: minimize deploy cutover downtime
This commit is contained in:
1 parent
828fda63e7
commit
bfc951cfd9
2 files changed
+34
-25
No files matched your search
@@ -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", () => {
|
||||
|
||||
Reference in new issue
Block a user