ci(metis): harden transient agent failures

This commit is contained in:
codex 2026-05-20 04:25:51 -03:00
parent 186b503243
commit 2121db7613

58
Jenkinsfile vendored
View File

@ -2,6 +2,7 @@ pipeline {
agent {
kubernetes {
defaultContainer 'builder'
retries 2
yaml """
apiVersion: v1
kind: Pod
@ -29,6 +30,7 @@ spec:
operator: NotIn
values:
- titan-13
- titan-12
- titan-15
- titan-17
- titan-19
@ -461,29 +463,55 @@ PY
post {
always {
script {
if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) {
withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) {
container('publisher') {
sh '''
set -eu
python scripts/publish_test_metrics.py
'''
try {
if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) {
withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) {
container('publisher') {
sh '''
set -eu
python scripts/publish_test_metrics.py
'''
}
}
} else {
echo 'quality metrics artifacts missing; skipping metrics publish'
}
} catch (Throwable err) {
if (err.class.simpleName == 'MissingContextVariableException') {
echo 'workspace unavailable; skipping metrics publish'
} else {
throw err
}
} else {
echo 'quality metrics artifacts missing; skipping metrics publish'
}
}
script {
if (fileExists('build/junit.xml')) {
try {
junit allowEmptyResults: true, testResults: 'build/junit.xml'
} catch (Throwable err) {
echo "junit step unavailable: ${err.class.simpleName}"
try {
if (fileExists('build/junit.xml')) {
try {
junit allowEmptyResults: true, testResults: 'build/junit.xml'
} catch (Throwable err) {
echo "junit step unavailable: ${err.class.simpleName}"
}
}
} catch (Throwable err) {
if (err.class.simpleName == 'MissingContextVariableException') {
echo 'workspace unavailable; skipping junit publish'
} else {
throw err
}
}
}
script {
try {
archiveArtifacts artifacts: 'build/**', allowEmptyArchive: true, fingerprint: true
} catch (Throwable err) {
if (err.class.simpleName == 'MissingContextVariableException') {
echo 'workspace unavailable; skipping artifact archive'
} else {
throw err
}
}
}
archiveArtifacts artifacts: 'build/**', allowEmptyArchive: true, fingerprint: true
}
}
}