fix(demo): read the container exit code, not the Job status
Some checks failed
Tests / Declarative: Post Actions testing.tests.test_repo_structure.test_knowledge_service_mirror_matches_source failed
Some checks failed
Tests / Declarative: Post Actions testing.tests.test_repo_structure.test_knowledge_service_mirror_matches_source failed
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 <noreply@anthropic.com>
This commit is contained in:
parent
a2e167895b
commit
51338921b6
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user