feat(cicd): add bounded pipeline evidence

This commit is contained in:
Codex
2026-07-04 02:40:43 +00:00
parent bc681eddf8
commit 3886bbbb2c
13 changed files with 264 additions and 1 deletions
+25
View File
@@ -121,6 +121,7 @@ while (Date.now() <= deadline) {
const complete = condition(latest, "Complete");
const failed = condition(latest, "Failed");
const logs = await logsTail();
const summary = parseLastJsonSummary(logs);
const timedOut = !complete && !failed;
const output = {
ok: Boolean(complete) && !timedOut,
@@ -137,6 +138,7 @@ const output = {
conditionReason: complete?.reason || failed?.reason || null,
conditionMessage: complete?.message || failed?.message || null,
logsTail: logs || null,
summary,
statusAuthority: "kubernetes-api-serviceaccount",
parsedDownstreamCliOutput: false,
valuesRedacted: true,
@@ -155,3 +157,26 @@ function requiredPositiveNumber(name) {
if (!Number.isFinite(value) || value <= 0) throw new Error(`${name} must be a positive number`);
return value;
}
function parseLastJsonSummary(text) {
const lines = String(text || "").split(/\r?\n/u).map((item) => item.trim()).filter(Boolean);
for (let index = lines.length - 1; index >= 0; index -= 1) {
try {
const parsed = JSON.parse(lines[index]);
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return compactValue(parsed, 0);
} catch {
continue;
}
}
return null;
}
function compactValue(value, depth) {
if (typeof value === "string") return value.length <= 240 ? value : `${value.slice(0, 160)} ... ${value.slice(-60)}`;
if (typeof value !== "object" || value === null) return value;
if (Array.isArray(value)) return value.slice(0, 8).map((item) => compactValue(item, depth + 1));
if (depth >= 3) return "[bounded-object]";
const output = {};
for (const [key, child] of Object.entries(value).slice(0, 16)) output[key] = compactValue(child, depth + 1);
return output;
}