fix: expose pac sentinel cicd diagnosis
This commit is contained in:
@@ -280,6 +280,7 @@ function runSentinelControlPlane(state: SentinelCicdState, options: Extract<WebP
|
||||
}),
|
||||
observed,
|
||||
statusDiagnosis,
|
||||
drillDown: controlPlaneDrillDown(state, pipelineRun, null),
|
||||
warnings: mergeWarnings(observedWarnings, record(statusDiagnosis).warning),
|
||||
blocker: observedReady
|
||||
? null
|
||||
@@ -321,6 +322,7 @@ function runSentinelPublishCurrent(state: SentinelCicdState, options: Extract<We
|
||||
budget: publishCurrentBudget(state),
|
||||
validationPlan: publishCurrentHealthValidationPlan(state),
|
||||
stageBudgets: publishCurrentStageBudgets(state),
|
||||
drillDown: controlPlaneDrillDown(state, sentinelPipelineRunName(state, options.rerun), null),
|
||||
blocker: state.configReady && state.sourceHead.ok ? null : { code: "sentinel-publish-current-plan-blocked", reason: "sentinel config or source head is not ready" },
|
||||
next: publishCurrentNext(state),
|
||||
valuesRedacted: true,
|
||||
@@ -396,6 +398,7 @@ function runSentinelPublishCurrentConfirmedInner(state: SentinelCicdState, optio
|
||||
timings: publishCurrentStageTimings({ publish }, null, elapsedMs),
|
||||
slowStages: publishCurrentSlowStages(state, publishCurrentStageTimings({ publish }, null, elapsedMs), budgetSeconds),
|
||||
withinBudget: elapsedMs <= budgetSeconds * 1000,
|
||||
drillDown: controlPlaneDrillDown(state, record(publish).jobName ?? sentinelPipelineRunName(state, options.rerun), null),
|
||||
warnings: [
|
||||
"PaC in-cluster publish-current submits the native sentinel publish PipelineRun and leaves Argo/runtime closeout to platform-infra pipelines-as-code status.",
|
||||
...sentinelCicdElapsedWarnings(record(publish).elapsedMs, "sentinel publish", controlPlaneWaitWarningSeconds(state)),
|
||||
@@ -481,6 +484,7 @@ function runSentinelPublishCurrentConfirmedInner(state: SentinelCicdState, optio
|
||||
withinBudget,
|
||||
timings,
|
||||
slowStages,
|
||||
drillDown: controlPlaneDrillDown(state, record(controlResult).pipelineRun ?? record(controlResult.publish).jobName ?? sentinelPipelineRunName(state, options.rerun), record(controlResult.flush)),
|
||||
warnings: mergeWarnings(controlResult.warnings, publishCurrentBudgetWarnings(slowStages, withinBudget, budgetSeconds, elapsedMs)),
|
||||
blocker,
|
||||
next: publishCurrentNext(state),
|
||||
@@ -1763,6 +1767,7 @@ function sentinelControlPlaneConfirmedResult(state: SentinelCicdState, options:
|
||||
observed,
|
||||
targetValidation,
|
||||
elapsedMs,
|
||||
drillDown: controlPlaneDrillDown(state, publishPipelineRun, flush),
|
||||
warnings: Array.from(new Set([
|
||||
...sentinelCicdElapsedWarnings(elapsedMs, "sentinel control-plane confirm-wait", cicdWaitWarningSeconds),
|
||||
...sentinelCicdElapsedWarnings(record(sourceMirrorSync).elapsedMs, "sentinel source mirror sync", cicdWaitWarningSeconds),
|
||||
@@ -2462,6 +2467,31 @@ function controlPlaneRecoveryNext(state: SentinelCicdState, ok: boolean, publish
|
||||
};
|
||||
}
|
||||
|
||||
function controlPlaneDrillDown(state: SentinelCicdState, pipelineRun: unknown, flush: unknown): Record<string, unknown> {
|
||||
const pipelineRunName = nonEmptyString(pipelineRun);
|
||||
const next = controlPlaneNext(state, "status");
|
||||
const pacBase = "bun scripts/cli.ts platform-infra pipelines-as-code";
|
||||
const flushRecord = record(flush);
|
||||
const flushNext = record(flushRecord.next);
|
||||
const flushJob = record(flushRecord.job);
|
||||
return {
|
||||
pipelineRun: pipelineRunName,
|
||||
pipelineRunStatus: pipelineRunName === null
|
||||
? null
|
||||
: `${pacBase} history --target ${state.spec.nodeId} --id ${pipelineRunName}`,
|
||||
pipelineRunFull: pipelineRunName === null
|
||||
? null
|
||||
: `${pacBase} history --target ${state.spec.nodeId} --id ${pipelineRunName} --full`,
|
||||
consumerStatus: `${pacBase} status --target ${state.spec.nodeId} --consumer sentinel-${state.spec.nodeId.toLowerCase()}-${state.spec.lane}`,
|
||||
imageStatus: `bun scripts/cli.ts web-probe sentinel image status --node ${state.spec.nodeId} --lane ${state.spec.lane}${sentinelCliSuffix(state)}`,
|
||||
gitMirrorStatus: next.gitMirrorStatus,
|
||||
gitMirrorFlush: next.gitMirrorFlush,
|
||||
asyncFlushJob: nonEmptyString(flushJob.id),
|
||||
asyncFlushStatus: nonEmptyString(flushNext.status),
|
||||
valuesRedacted: true,
|
||||
};
|
||||
}
|
||||
|
||||
function applySentinelRuntimeSecrets(state: SentinelCicdState, timeoutSeconds: number): Record<string, unknown> {
|
||||
const sourcesByPurpose = new Map<string, Record<string, unknown>>();
|
||||
for (const source of arrayAt(state.secrets, "sources").map(record)) {
|
||||
|
||||
Reference in New Issue
Block a user