fix: bound node runtime cicd wait closeout
This commit is contained in:
@@ -348,8 +348,9 @@ export function waitForNodeRuntimePipelineRunTerminal(
|
||||
options: { opportunisticPostFlush?: () => Record<string, unknown> | null; opportunisticPostSync?: () => Record<string, unknown> | null } = {},
|
||||
): Record<string, unknown> {
|
||||
const severeWarningThresholdMs = 120_000;
|
||||
const effectiveTimeoutSeconds = Math.max(0, timeoutSeconds);
|
||||
const startedAt = Date.now();
|
||||
const deadline = startedAt + timeoutSeconds * 1000;
|
||||
const deadline = startedAt + effectiveTimeoutSeconds * 1000;
|
||||
let polls = 0;
|
||||
let last: Record<string, unknown> = { exists: false, name: pipelineRun };
|
||||
let lastOpportunisticPostFlushAt = 0;
|
||||
@@ -357,7 +358,21 @@ export function waitForNodeRuntimePipelineRunTerminal(
|
||||
let opportunisticPostSyncAttempted = false;
|
||||
const opportunisticPostFlushes: Record<string, unknown>[] = [];
|
||||
const opportunisticPostSyncs: Record<string, unknown>[] = [];
|
||||
printNodeRuntimeTriggerProgress(spec, { stage: "pipelinerun-wait", status: "started", pipelineRun, timeoutSeconds });
|
||||
printNodeRuntimeTriggerProgress(spec, { stage: "pipelinerun-wait", status: "started", pipelineRun, timeoutSeconds: effectiveTimeoutSeconds });
|
||||
if (effectiveTimeoutSeconds <= 0) {
|
||||
const warning = nodeRuntimeCicdWaitWarning(spec, pipelineRun, { polls, elapsedMs: 0 });
|
||||
printNodeRuntimeTriggerProgress(spec, { stage: "pipelinerun-wait", status: "warning", pipelineRun, polls, elapsedMs: 0, waitLimitSeconds: effectiveTimeoutSeconds });
|
||||
return {
|
||||
ok: false,
|
||||
status: "pending",
|
||||
pipelineRun: last,
|
||||
polls,
|
||||
elapsedMs: 0,
|
||||
waitLimitSeconds: effectiveTimeoutSeconds,
|
||||
warning,
|
||||
next: { status: `bun scripts/cli.ts hwlab nodes control-plane status --node ${spec.nodeId} --lane ${spec.lane} --pipeline-run ${pipelineRun}` },
|
||||
};
|
||||
}
|
||||
while (Date.now() <= deadline) {
|
||||
polls += 1;
|
||||
last = getNodeRuntimePipelineRun(spec, pipelineRun);
|
||||
@@ -445,7 +460,7 @@ export function waitForNodeRuntimePipelineRunTerminal(
|
||||
const warning = nodeRuntimeCicdWaitWarning(spec, pipelineRun, { polls, elapsedMs });
|
||||
printNodeRuntimeTriggerProgress(spec, { stage: "pipelinerun-wait", status: "warning", pipelineRun, polls, elapsedMs, waitLimitSeconds: timeoutSeconds });
|
||||
return {
|
||||
ok: true,
|
||||
ok: false,
|
||||
status: "pending",
|
||||
pipelineRun: last,
|
||||
polls,
|
||||
|
||||
Reference in New Issue
Block a user