fix: expose v02 trigger progress

This commit is contained in:
Codex
2026-05-31 04:49:54 +00:00
parent 69f72a49cb
commit f01f840628
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -382,6 +382,10 @@ function printEvent(event: string, data: Record<string, unknown> = {}): void {
process.stdout.write(`${JSON.stringify({ event, at: new Date().toISOString(), ...data })}\n`);
}
function printProgressEvent(event: string, data: Record<string, unknown> = {}): void {
process.stderr.write(`${JSON.stringify({ event, at: new Date().toISOString(), ...data })}\n`);
}
function shortSha(sha: string): string {
return sha.slice(0, 12);
}
@@ -1010,7 +1014,9 @@ function runV02ControlPlane(options: G14ControlPlaneOptions): Record<string, unk
degradedReason: "refuse-active-or-successful-pipelinerun",
};
}
printProgressEvent("hwlab.v02.trigger.progress", { stage: "control-plane-refresh", status: "started", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit) });
const controlPlaneRefresh = refreshV02ControlPlaneBeforeTrigger(sourceCommit, options.timeoutSeconds);
printProgressEvent("hwlab.v02.trigger.progress", { stage: "control-plane-refresh", status: controlPlaneRefresh.ok === true ? "succeeded" : "failed", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit), degradedReason: record(controlPlaneRefresh).degradedReason ?? null });
if (controlPlaneRefresh.ok !== true) {
return {
ok: false,
@@ -1025,7 +1031,9 @@ function runV02ControlPlane(options: G14ControlPlaneOptions): Record<string, unk
degradedReason: record(controlPlaneRefresh).degradedReason ?? "control-plane-refresh-failed",
};
}
printProgressEvent("hwlab.v02.trigger.progress", { stage: "git-mirror-pre-sync", status: "started", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit) });
const gitMirrorPreSync = preSyncV02GitMirror(sourceCommit, options);
printProgressEvent("hwlab.v02.trigger.progress", { stage: "git-mirror-pre-sync", status: gitMirrorPreSync.ok === true ? "succeeded" : "failed", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit), mode: record(gitMirrorPreSync).mode ?? null, degradedReason: record(gitMirrorPreSync).degradedReason ?? null });
if (gitMirrorPreSync.ok !== true) {
return {
ok: false,
@@ -1041,10 +1049,14 @@ function runV02ControlPlane(options: G14ControlPlaneOptions): Record<string, unk
degradedReason: "git-mirror-pre-sync-failed",
};
}
printProgressEvent("hwlab.v02.trigger.progress", { stage: "delete-existing-pipelinerun", status: "started", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit) });
const deletePipelineRun = deleteV02PipelineRun(v02PipelineRunName(sourceCommit));
printProgressEvent("hwlab.v02.trigger.progress", { stage: "delete-existing-pipelinerun", status: isCommandSuccess(deletePipelineRun) ? "succeeded" : "failed", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit), exitCode: deletePipelineRun.exitCode });
printProgressEvent("hwlab.v02.trigger.progress", { stage: "create-pipelinerun", status: "started", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit) });
const createPipelineRun = isCommandSuccess(deletePipelineRun)
? createV02PipelineRun(sourceCommit, options.timeoutSeconds)
: null;
printProgressEvent("hwlab.v02.trigger.progress", { stage: "create-pipelinerun", status: createPipelineRun !== null && isCommandSuccess(createPipelineRun) ? "succeeded" : "failed", sourceCommit, pipelineRun: v02PipelineRunName(sourceCommit), exitCode: createPipelineRun?.exitCode ?? null });
return {
ok: isCommandSuccess(deletePipelineRun) && createPipelineRun !== null && isCommandSuccess(createPipelineRun),
command: "hwlab g14 control-plane trigger-current --lane v02",