cicd expose reconcile job logs

This commit is contained in:
Codex
2026-07-03 11:06:42 +00:00
parent 9a3d665303
commit c754549df2
2 changed files with 10 additions and 2 deletions
+8 -2
View File
@@ -6,8 +6,14 @@ deadline=$(( $(date +%s) + ${TIMEOUT_SECONDS} ))
while true; do
job_json=$(kubectl -n "${NAMESPACE}" get job "${JOB_NAME}" -o json)
phase=$(printf '%s' "${job_json}" | node -e "let s='';process.stdin.on('data',c=>s+=c);process.stdin.on('end',()=>{const j=JSON.parse(s);const c=j.status?.conditions||[];const done=c.find(x=>x.type==='Complete'&&x.status==='True');const failed=c.find(x=>x.type==='Failed'&&x.status==='True');process.stdout.write(done?'complete':failed?'failed':'running');})")
if [ "${phase}" = complete ]; then exit 0; fi
if [ "${phase}" = failed ]; then exit 1; fi
if [ "${phase}" = complete ]; then
kubectl -n "${NAMESPACE}" logs "job/${JOB_NAME}" --all-containers --tail=240 2>/dev/null || true
exit 0
fi
if [ "${phase}" = failed ]; then
kubectl -n "${NAMESPACE}" logs "job/${JOB_NAME}" --all-containers --tail=240 2>/dev/null || true
exit 1
fi
if [ "$(date +%s)" -ge "${deadline}" ]; then exit 124; fi
sleep 2
done
+2
View File
@@ -2145,6 +2145,8 @@ function runControllerReconcileJob(registry: BranchFollowerRegistry, options: Pa
exitCode: result.exitCode,
timedOut: result.timedOut,
message: result.exitCode === 0 ? "reconcile job completed" : redactText(tailText(result.stderr || result.stdout, 800)),
stdoutTail: redactText(tailText(result.stdout, options.full ? 4000 : 1000)),
stderrTail: redactText(tailText(result.stderr, options.full ? 2000 : 800)),
};
}