fix: avoid blocking v02 mirror apply on temp render drift
This commit is contained in:
+17
-18
@@ -716,7 +716,7 @@ function runControlPlaneCleanup(options: G14ControlPlaneOptions): Record<string,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function runV02RenderCheck(sourceCommit: string): CommandJsonResult {
|
function runV02RenderToTemp(sourceCommit: string): CommandJsonResult {
|
||||||
const renderDir = v02RenderDir(sourceCommit);
|
const renderDir = v02RenderDir(sourceCommit);
|
||||||
return v02WorkspaceScript([
|
return v02WorkspaceScript([
|
||||||
"set -eu",
|
"set -eu",
|
||||||
@@ -727,7 +727,6 @@ function runV02RenderCheck(sourceCommit: string): CommandJsonResult {
|
|||||||
`rm -rf ${shellQuote(renderDir)}`,
|
`rm -rf ${shellQuote(renderDir)}`,
|
||||||
`mkdir -p ${shellQuote(renderDir)}`,
|
`mkdir -p ${shellQuote(renderDir)}`,
|
||||||
`node scripts/g14-gitops-render.mjs --lane v02 --source-revision ${shellQuote(sourceCommit)} --out ${shellQuote(renderDir)}`,
|
`node scripts/g14-gitops-render.mjs --lane v02 --source-revision ${shellQuote(sourceCommit)} --out ${shellQuote(renderDir)}`,
|
||||||
`node scripts/g14-gitops-render.mjs --lane v02 --source-revision ${shellQuote(sourceCommit)} --out ${shellQuote(renderDir)} --check`,
|
|
||||||
].join("\n"), 180_000);
|
].join("\n"), 180_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,15 +755,15 @@ function applyV02ControlPlaneFiles(sourceCommit: string, dryRun: boolean, timeou
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshV02ControlPlaneBeforeTrigger(sourceCommit: string, timeoutSeconds: number): Record<string, unknown> {
|
function refreshV02ControlPlaneBeforeTrigger(sourceCommit: string, timeoutSeconds: number): Record<string, unknown> {
|
||||||
const renderCheck = runV02RenderCheck(sourceCommit);
|
const render = runV02RenderToTemp(sourceCommit);
|
||||||
if (!isCommandSuccess(renderCheck)) {
|
if (!isCommandSuccess(render)) {
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
phase: "source-render-check",
|
phase: "source-render",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
renderDir: v02RenderDir(sourceCommit),
|
renderDir: v02RenderDir(sourceCommit),
|
||||||
renderCheck,
|
render,
|
||||||
degradedReason: "control-plane-render-check-failed",
|
degradedReason: "control-plane-render-failed",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const apply = applyV02ControlPlaneFiles(sourceCommit, false, timeoutSeconds);
|
const apply = applyV02ControlPlaneFiles(sourceCommit, false, timeoutSeconds);
|
||||||
@@ -774,7 +773,7 @@ function refreshV02ControlPlaneBeforeTrigger(sourceCommit: string, timeoutSecond
|
|||||||
phase: "control-plane-refresh",
|
phase: "control-plane-refresh",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
renderDir: v02RenderDir(sourceCommit),
|
renderDir: v02RenderDir(sourceCommit),
|
||||||
renderCheck: commandData(renderCheck),
|
render: commandData(render),
|
||||||
apply,
|
apply,
|
||||||
cleanupObsoleteCronJobs,
|
cleanupObsoleteCronJobs,
|
||||||
degradedReason: !isCommandSuccess(apply)
|
degradedReason: !isCommandSuccess(apply)
|
||||||
@@ -954,14 +953,14 @@ function runV02ControlPlane(options: G14ControlPlaneOptions): Record<string, unk
|
|||||||
if (options.action === "runtime-migration") return runV02RuntimeMigration(options, sourceCommit);
|
if (options.action === "runtime-migration") return runV02RuntimeMigration(options, sourceCommit);
|
||||||
if (options.action === "status") return v02ControlPlaneStatus(sourceCommit);
|
if (options.action === "status") return v02ControlPlaneStatus(sourceCommit);
|
||||||
if (options.action === "apply") {
|
if (options.action === "apply") {
|
||||||
const renderCheck = runV02RenderCheck(sourceCommit);
|
const render = runV02RenderToTemp(sourceCommit);
|
||||||
if (!isCommandSuccess(renderCheck)) {
|
if (!isCommandSuccess(render)) {
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
command: `hwlab g14 control-plane ${options.action} --lane v02`,
|
command: `hwlab g14 control-plane ${options.action} --lane v02`,
|
||||||
phase: "source-render-check",
|
phase: "source-render",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
renderCheck,
|
render,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const apply = applyV02ControlPlaneFiles(sourceCommit, options.dryRun, options.timeoutSeconds);
|
const apply = applyV02ControlPlaneFiles(sourceCommit, options.dryRun, options.timeoutSeconds);
|
||||||
@@ -972,7 +971,7 @@ function runV02ControlPlane(options: G14ControlPlaneOptions): Record<string, unk
|
|||||||
mode: options.dryRun ? "dry-run" : "confirmed-apply",
|
mode: options.dryRun ? "dry-run" : "confirmed-apply",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
renderDir: v02RenderDir(sourceCommit),
|
renderDir: v02RenderDir(sourceCommit),
|
||||||
renderCheck: commandData(renderCheck),
|
render: commandData(render),
|
||||||
apply,
|
apply,
|
||||||
cleanupObsoleteCronJobs: options.dryRun ? deleteV02ObsoleteCronJobs(true) : deleteV02ObsoleteCronJobs(false),
|
cleanupObsoleteCronJobs: options.dryRun ? deleteV02ObsoleteCronJobs(true) : deleteV02ObsoleteCronJobs(false),
|
||||||
status: v02ControlPlaneStatus(sourceCommit),
|
status: v02ControlPlaneStatus(sourceCommit),
|
||||||
@@ -1384,14 +1383,14 @@ function runGitMirrorApply(options: G14GitMirrorOptions): Record<string, unknown
|
|||||||
if (sourceCommit === null) {
|
if (sourceCommit === null) {
|
||||||
return { ok: false, command: "hwlab g14 git-mirror apply", degradedReason: "v02-head-unresolved", workspace: V02_WORKSPACE };
|
return { ok: false, command: "hwlab g14 git-mirror apply", degradedReason: "v02-head-unresolved", workspace: V02_WORKSPACE };
|
||||||
}
|
}
|
||||||
const renderCheck = runV02RenderCheck(sourceCommit);
|
const render = runV02RenderToTemp(sourceCommit);
|
||||||
if (!isCommandSuccess(renderCheck)) {
|
if (!isCommandSuccess(render)) {
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
command: "hwlab g14 git-mirror apply",
|
command: "hwlab g14 git-mirror apply",
|
||||||
phase: "source-render-check",
|
phase: "source-render",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
renderCheck,
|
render,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const apply = applyGitMirrorManifestFile(sourceCommit, options.dryRun, options.timeoutSeconds);
|
const apply = applyGitMirrorManifestFile(sourceCommit, options.dryRun, options.timeoutSeconds);
|
||||||
@@ -1411,7 +1410,7 @@ function runGitMirrorApply(options: G14GitMirrorOptions): Record<string, unknown
|
|||||||
mode: options.dryRun ? "dry-run" : "confirmed-apply",
|
mode: options.dryRun ? "dry-run" : "confirmed-apply",
|
||||||
sourceCommit,
|
sourceCommit,
|
||||||
manifest: `${v02RenderDir(sourceCommit)}/devops-infra/git-mirror.yaml`,
|
manifest: `${v02RenderDir(sourceCommit)}/devops-infra/git-mirror.yaml`,
|
||||||
renderCheck: commandData(renderCheck),
|
render: commandData(render),
|
||||||
apply,
|
apply,
|
||||||
cleanupLegacyCronJob,
|
cleanupLegacyCronJob,
|
||||||
status: runGitMirrorStatus(),
|
status: runGitMirrorStatus(),
|
||||||
|
|||||||
Reference in New Issue
Block a user