fix(hwlab): show runtime blockers in node status (#730)
Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
@@ -3070,12 +3070,26 @@ function withNodeRuntimeControlPlanePlanRendered(result: Record<string, unknown>
|
||||
|
||||
function withNodeRuntimeControlPlaneStatusRendered(result: Record<string, unknown>, scoped: ReturnType<typeof parseNodeScopedDelegatedOptions>): RenderedCliResult {
|
||||
const pipelineRun = record(result.pipelineRun);
|
||||
const pipelineRunDiagnostics = record(pipelineRun.diagnostics);
|
||||
const argo = record(result.argo);
|
||||
const runtime = record(result.runtime);
|
||||
const publicProbe = record(result.publicProbe);
|
||||
const gitMirror = record(result.gitMirror);
|
||||
const next = record(result.next);
|
||||
const diagnostic = record(publicProbe.diagnostic);
|
||||
const notReadyWorkloads = Array.isArray(runtime.notReadyWorkloads) ? runtime.notReadyWorkloads.map((item) => webObserveText(item)).filter(Boolean) : [];
|
||||
const runtimeDetail = [
|
||||
`workloads=${webObserveText(runtime.workloadReady)}`,
|
||||
`pg=${webObserveText(runtime.externalPostgresReady ?? runtime.localPostgresReady)}`,
|
||||
...(notReadyWorkloads.length > 0 ? [`notReady=${webObserveShort(notReadyWorkloads.join(","), 80)}`] : []),
|
||||
].join(" ");
|
||||
const failedTaskRuns = Array.isArray(pipelineRunDiagnostics.failedTaskRuns) ? pipelineRunDiagnostics.failedTaskRuns.map(compactNodeRuntimeTaskRunDiagnostic).filter(Boolean) : [];
|
||||
const pendingTaskRuns = Array.isArray(pipelineRunDiagnostics.pendingTaskRuns) ? pipelineRunDiagnostics.pendingTaskRuns.map(compactNodeRuntimeTaskRunDiagnostic).filter(Boolean) : [];
|
||||
const pipelineDetail = [
|
||||
webObserveShort(webObserveText(pipelineRun.reason ?? pipelineRun.message), 50),
|
||||
...(failedTaskRuns.length > 0 ? [`failed=${webObserveShort(failedTaskRuns.join(","), 80)}`] : []),
|
||||
...(pendingTaskRuns.length > 0 ? [`pending=${webObserveShort(pendingTaskRuns.join(","), 80)}`] : []),
|
||||
].filter(Boolean).join(" ");
|
||||
const status = result.ok === true ? "ok" : result.ok === false ? "failed" : "-";
|
||||
const renderedText = [
|
||||
"hwlab nodes control-plane status",
|
||||
@@ -3095,9 +3109,9 @@ function withNodeRuntimeControlPlaneStatusRendered(result: Record<string, unknow
|
||||
webObserveTable(
|
||||
["STAGE", "STATUS", "DETAIL"],
|
||||
[
|
||||
["pipeline", pipelineRun.ready === true ? "ok" : pipelineRun.exists === true ? webObserveText(pipelineRun.status) : "missing", webObserveShort(webObserveText(pipelineRun.reason ?? pipelineRun.message), 80)],
|
||||
["pipeline", pipelineRun.ready === true ? "ok" : pipelineRun.exists === true ? webObserveText(pipelineRun.status) : "missing", pipelineDetail],
|
||||
["argo", argo.ready === true ? "ok" : "failed", `${webObserveText(argo.syncStatus)}/${webObserveText(argo.health)} rev=${shortValue(argo.syncRevision)}`],
|
||||
["runtime", runtime.ready === true ? "ok" : "failed", `workloads=${webObserveText(runtime.workloadReady)} pg=${webObserveText(runtime.externalPostgresReady ?? runtime.localPostgresReady)}`],
|
||||
["runtime", runtime.ready === true ? "ok" : "failed", runtimeDetail],
|
||||
["public", publicProbe.ready === true ? "ok" : "failed", webObserveShort(webObserveText(diagnostic.kind ?? diagnostic.message), 80)],
|
||||
["git-mirror", gitMirror.ready === true ? "ok" : "failed", `pending=${webObserveText(gitMirror.pendingFlush)} inSync=${webObserveText(gitMirror.githubInSync)}`],
|
||||
],
|
||||
@@ -4158,6 +4172,15 @@ function joinUrlPath(baseUrl: string, suffix: string): string {
|
||||
return `${baseUrl.replace(/\/+$/u, "")}/${suffix.replace(/^\/+/u, "")}`;
|
||||
}
|
||||
|
||||
function compactNodeRuntimeTaskRunDiagnostic(value: unknown): string {
|
||||
const item = record(value);
|
||||
const pipelineTask = webObserveText(item.pipelineTask ?? item.pipelineTaskName);
|
||||
const taskRun = webObserveText(item.taskRun ?? item.name);
|
||||
const reason = webObserveText(item.reason ?? item.status ?? item.message);
|
||||
const left = [pipelineTask, taskRun].filter(Boolean).join("/");
|
||||
return [left, reason ? `(${webObserveShort(reason, 36)})` : ""].filter(Boolean).join("");
|
||||
}
|
||||
|
||||
function summarizeNodeRuntimeControlPlaneStatus(status: Record<string, unknown>, scoped: ReturnType<typeof parseNodeScopedDelegatedOptions>): Record<string, unknown> {
|
||||
const pipelineRun = record(status.pipelineRun);
|
||||
const pipelineRunDiagnostics = record(status.pipelineRunDiagnostics);
|
||||
@@ -4168,6 +4191,7 @@ function summarizeNodeRuntimeControlPlaneStatus(status: Record<string, unknown>,
|
||||
const gitMirrorCompact = record(gitMirror.compact);
|
||||
const workloadReadiness = Array.isArray(runtime.workloadReadiness) ? runtime.workloadReadiness.map(record) : [];
|
||||
const readyWorkloads = workloadReadiness.filter((item) => item.ready === true).length;
|
||||
const notReadyWorkloads = workloadReadiness.filter((item) => item.ready !== true).map((item) => item.ref).filter(Boolean);
|
||||
const workloadCount = typeof runtime.workloadCount === "number" ? runtime.workloadCount : workloadReadiness.length;
|
||||
const webProbe = record(publicProbes.web);
|
||||
const apiProbe = record(publicProbes.apiHealth);
|
||||
@@ -4218,6 +4242,7 @@ function summarizeNodeRuntimeControlPlaneStatus(status: Record<string, unknown>,
|
||||
ready: runtime.ready === true,
|
||||
workloadCount,
|
||||
workloadReady: `${readyWorkloads}/${workloadReadiness.length}`,
|
||||
notReadyWorkloads,
|
||||
localPostgresAbsent: runtime.localPostgresAbsent === true,
|
||||
localPostgresExpectedAbsent: runtime.localPostgresExpectedAbsent === true,
|
||||
localPostgresReady: runtime.localPostgresReady === true,
|
||||
|
||||
Reference in New Issue
Block a user