ci(metis): harden transient agent failures

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

28
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,6 +463,7 @@ PY
post { post {
always { always {
script { script {
try {
if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) { if (fileExists(env.COVERAGE_JSON) && fileExists(env.JUNIT_XML)) {
withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) { withEnv(["QUALITY_GATE_FINAL_STATUS=${currentBuild.currentResult ?: 'SUCCESS'}"]) {
container('publisher') { container('publisher') {
@ -473,8 +476,16 @@ PY
} else { } else {
echo 'quality metrics artifacts missing; skipping metrics publish' 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
}
}
} }
script { script {
try {
if (fileExists('build/junit.xml')) { if (fileExists('build/junit.xml')) {
try { try {
junit allowEmptyResults: true, testResults: 'build/junit.xml' junit allowEmptyResults: true, testResults: 'build/junit.xml'
@ -482,8 +493,25 @@ PY
echo "junit step unavailable: ${err.class.simpleName}" 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 archiveArtifacts artifacts: 'build/**', allowEmptyArchive: true, fingerprint: true
} catch (Throwable err) {
if (err.class.simpleName == 'MissingContextVariableException') {
echo 'workspace unavailable; skipping artifact archive'
} else {
throw err
}
}
}
} }
} }
} }