From d152da95bcced4de2711093d9e27757486fe2f74 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 1 Jun 2026 18:40:29 +0000 Subject: [PATCH] fix: show agentrun pipelinerun condition message --- scripts/src/agentrun.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/src/agentrun.ts b/scripts/src/agentrun.ts index 64cec81c..6d1be301 100644 --- a/scripts/src/agentrun.ts +++ b/scripts/src/agentrun.ts @@ -113,6 +113,7 @@ async function status(config: UniDeskConfig): Promise> { const argo = parseArgoStatus(k3s.stdout); const mirror = await gitMirrorStatus(config); const ciSummary = labeledJson(k3s.stdout, "ciSummary"); + const pipelineRunCondition = labeledJson(k3s.stdout, "pipelineRunCondition"); return { ok: source.exitCode === 0 && k3s.exitCode === 0 && mirror.ok === true, command: "agentrun v01 control-plane status", @@ -125,6 +126,7 @@ async function status(config: UniDeskConfig): Promise> { expectedPipelineRun: pipelineRun, source: compactCapture(source), runtime: compactCapture(k3s), + pipelineRunCondition, ciSummary, gitMirror: { ok: mirror.ok, @@ -291,6 +293,26 @@ function statusScript(pipelineRun: string | null): string { pr.length > 0 ? `kubectl -n ${ciNamespace} get pipelinerun ${shQuote(pr)} -o 'jsonpath={.metadata.name}{\"\\t\"}{.status.conditions[0].status}{\"\\t\"}{.status.conditions[0].reason}{\"\\t\"}{.status.startTime}{\"\\t\"}{.status.completionTime}{\"\\n\"}' 2>/dev/null || true` : "true", + "printf 'pipelineRunCondition='", + pr.length > 0 + ? [ + `if kubectl -n ${ciNamespace} get pipelinerun ${shQuote(pr)} -o json >/tmp/agentrun-v01-pipelinerun.json 2>/dev/null; then`, + "node <<'NODE'", + "const fs = require('node:fs');", + "const pr = JSON.parse(fs.readFileSync('/tmp/agentrun-v01-pipelinerun.json', 'utf8'));", + "const condition = pr?.status?.conditions?.[0] || {};", + "console.log(JSON.stringify({", + " name: pr?.metadata?.name || null,", + " status: condition.status || null,", + " reason: condition.reason || null,", + " message: condition.message || null,", + " startTime: pr?.status?.startTime || null,", + " completionTime: pr?.status?.completionTime || null", + "}));", + "NODE", + "else printf '{}\\n'; fi", + ].join("\n") + : "printf '{}\\n'", "printf 'taskRuns\\n'", pr.length > 0 ? `kubectl -n ${ciNamespace} get taskrun -l tekton.dev/pipelineRun=${shQuote(pr)} -o 'custom-columns=NAME:.metadata.name,STATUS:.status.conditions[0].status,REASON:.status.conditions[0].reason,START:.status.startTime,COMPLETION:.status.completionTime' --no-headers 2>/dev/null || true`