From 51338921b6fa7cb2bfe996e388ba0db1fc9dd7d4 Mon Sep 17 00:00:00 2001 From: jenkins Date: Thu, 6 Aug 2026 17:11:40 -0300 Subject: [PATCH] fix(demo): read the container exit code, not the Job status The fixture check waited on the Job's .status.succeeded/.status.failed. The kubelet records a container's exit code the instant it stops, but the Job controller reconciles those fields on its own schedule: observed at 2m24s, 4m27s and 34m on this cluster for identical work. During that window the pod had already exited 1 and the build sat printing 'Will try again after 13 sec', looking hung long after the test had finished, which is unusable in a demo. Polling the pod's terminated exitCode removes the controller from the path entirely. The Job is still used, so the evidence shape is unchanged. Co-Authored-By: Claude Opus 5 --- services/jenkins/configmap-jcasc.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/jenkins/configmap-jcasc.yaml b/services/jenkins/configmap-jcasc.yaml index 3c5822113..f84d2d797 100644 --- a/services/jenkins/configmap-jcasc.yaml +++ b/services/jenkins/configmap-jcasc.yaml @@ -605,11 +605,18 @@ data: writeFile file: 'test-runner-job.yaml', text: manifest.join('\\n') + '\\n' sh 'kubectl -n hermes-triage-demo create -f test-runner-job.yaml' def verdict = 'unknown' + // Read the container's exit code, not the Job status. + // The kubelet records the exit code the moment the + // container stops; the Job controller can take minutes + // to reconcile .status.failed, and has been observed + // taking over half an hour on this cluster. Waiting on + // the Job made the build look hung long after the test + // had actually finished. timeout(time: 3, unit: 'MINUTES') { waitUntil { - def st = sh(script: 'kubectl -n hermes-triage-demo get job ' + jobName + ' -o jsonpath={.status.succeeded}:{.status.failed}', returnStdout: true).trim() - if (st.startsWith('1')) { verdict = 'pass'; return true } - if (st.endsWith(':1')) { verdict = 'fail'; return true } + def code = sh(script: 'kubectl -n hermes-triage-demo get pods -l job-name=' + jobName + ' -o jsonpath="{.items[0].status.containerStatuses[0].state.terminated.exitCode}" 2>/dev/null || true', returnStdout: true).trim() + if (code == '0') { verdict = 'pass'; return true } + if (code != '') { verdict = 'fail'; return true } return false } }