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 { agent {
kubernetes { kubernetes {
defaultContainer 'builder' defaultContainer 'builder'
retries 2
yaml """ yaml """
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
@ -29,6 +30,7 @@ spec:
operator: NotIn operator: NotIn
values: values:
- titan-13 - titan-13
- titan-12
- titan-15 - titan-15
- titan-17 - titan-17
- titan-19 - titan-19
@ -461,29 +463,55 @@ PY
post { post {
always { always {
script { script {
if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) { try {
withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) { if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) {
container('publisher') { withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) {
sh ''' container('publisher') {
set -eu sh '''
python scripts/publish_test_metrics.py 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 { script {
if (fileExists('build/junit.xml')) { try {
try { if (fileExists('build/junit.xml')) {
junit allowEmptyResults: true, testResults: 'build/junit.xml' try {
} catch (Throwable err) { junit allowEmptyResults: true, testResults: 'build/junit.xml'
echo "junit step unavailable: ${err.class.simpleName}" } 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
} }
} }
} }