fix: expose pac sentinel cicd diagnosis
Pipelines as Code CI / hwlab-web-probe-sentinel-jd01- Success
Pipelines as Code CI / hwlab-web-probe-sentinel-jd01- Success
This commit is contained in:
@@ -615,6 +615,7 @@ function statusSummary(payload: Record<string, unknown>): Record<string, unknown
|
||||
const taskRuns = arrayRecords(payload.taskRuns);
|
||||
const argo = record(payload.argo);
|
||||
const runtime = record(payload.runtime);
|
||||
const diagnostics = record(payload.diagnostics);
|
||||
const artifact = {
|
||||
...record(payload.artifact),
|
||||
imageStatus: record(payload.artifact).imageStatus ?? (runtime.image === undefined ? undefined : "runtime"),
|
||||
@@ -622,7 +623,7 @@ function statusSummary(payload: Record<string, unknown>): Record<string, unknown
|
||||
gitopsCommit: record(payload.artifact).gitopsCommit ?? argo.revision,
|
||||
};
|
||||
return {
|
||||
ready: payload.crdPresent === true && String(payload.controllerReady ?? "0/0") !== "0/0",
|
||||
ready: payload.crdPresent === true && String(payload.controllerReady ?? "0/0") !== "0/0" && diagnostics.ok !== false,
|
||||
crdPresent: payload.crdPresent === true,
|
||||
controllerReady: payload.controllerReady,
|
||||
repositoryCondition: payload.repositoryCondition,
|
||||
@@ -632,6 +633,7 @@ function statusSummary(payload: Record<string, unknown>): Record<string, unknown
|
||||
artifact,
|
||||
argo,
|
||||
runtime,
|
||||
diagnostics,
|
||||
valuesPrinted: false,
|
||||
};
|
||||
}
|
||||
@@ -781,6 +783,7 @@ function renderStatus(result: Record<string, unknown>): RenderedCliResult {
|
||||
const taskRuns = arrayRecords(summary.taskRuns);
|
||||
const artifact = record(summary.artifact);
|
||||
const argo = record(summary.argo);
|
||||
const diagnostics = record(summary.diagnostics);
|
||||
const lines = [
|
||||
"PLATFORM-INFRA PIPELINES-AS-CODE STATUS",
|
||||
...(coverage.length === 0 ? [] : [
|
||||
@@ -802,6 +805,19 @@ function renderStatus(result: Record<string, unknown>): RenderedCliResult {
|
||||
"ARGO",
|
||||
...table(["SYNC", "HEALTH", "REVISION"], [[stringValue(argo.sync), stringValue(argo.health), short(stringValue(argo.revision))]]),
|
||||
"",
|
||||
"CICD DIAGNOSIS",
|
||||
...table(["OK", "CODE", "PHASE", "SOURCE", "REGISTRY", "GITOPS", "RUNTIME"], [[
|
||||
boolText(diagnostics.ok !== false),
|
||||
stringValue(diagnostics.code),
|
||||
stringValue(diagnostics.phase),
|
||||
short(stringValue(diagnostics.sourceCommit)),
|
||||
registryText(record(diagnostics.registry)),
|
||||
short(stringValue(record(diagnostics.gitops).commit)),
|
||||
runtimeText(record(diagnostics.runtime)),
|
||||
]]),
|
||||
` hint: ${compactLine(stringValue(diagnostics.hint))}`,
|
||||
` pipeline-run: ${latest.name === undefined ? "-" : `bun scripts/cli.ts platform-infra pipelines-as-code history --target ${stringValue(record(result.target).id)} --id ${stringValue(latest.name)}`}`,
|
||||
"",
|
||||
"NEXT",
|
||||
` full: ${stringValue(record(result.next).status)} --full`,
|
||||
` all-history: ${stringValue(record(result.next).history).replace(/ --consumer [^ ]+/u, "")} --limit 10`,
|
||||
@@ -1042,6 +1058,20 @@ function envReuseText(envReuse: Record<string, unknown>): string {
|
||||
return parts.length === 0 ? "-" : parts.join(",");
|
||||
}
|
||||
|
||||
function registryText(registry: Record<string, unknown>): string {
|
||||
if (Object.keys(registry).length === 0) return "-";
|
||||
const present = registry.present === true ? "present" : "missing";
|
||||
const digest = short(stringValue(registry.digest), 18);
|
||||
return digest === "-" ? present : `${present}:${digest}`;
|
||||
}
|
||||
|
||||
function runtimeText(runtime: Record<string, unknown>): string {
|
||||
if (Object.keys(runtime).length === 0) return "-";
|
||||
const ready = `${stringValue(runtime.readyReplicas)}/${stringValue(runtime.replicas)}`;
|
||||
const digest = short(stringValue(runtime.digest), 18);
|
||||
return digest === "-" ? ready : `${ready}:${digest}`;
|
||||
}
|
||||
|
||||
function renderHistoryDetail(row: Record<string, unknown>): string[] {
|
||||
const envReuse = record(row.envReuse);
|
||||
const taskRuns = record(row.taskRuns);
|
||||
|
||||
Reference in New Issue
Block a user