From 112bb349f7dbb0dcb5dec41fcf578c15195e5b08 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 10 Jun 2022 10:30:20 -0700 Subject: [PATCH] Preserve dumpstream on Maven failure (#6641) --- Jenkinsfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8016e9d913..05f5fbf239 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,9 +61,13 @@ for (i = 0; i < buildTypes.size(); i++) { 'clean', 'install', ] - infra.runMaven(mavenOptions, jdk) - if (isUnix()) { - sh 'git add . && git diff --exit-code HEAD' + try { + infra.runMaven(mavenOptions, jdk) + if (isUnix()) { + sh 'git add . && git diff --exit-code HEAD' + } + } finally { + archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/surefire-reports/*.dumpstream' } } } @@ -71,7 +75,6 @@ for (i = 0; i < buildTypes.size(); i++) { // Once we've built, archive the artifacts and the test results. stage("${buildType} Publishing") { - archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/surefire-reports/*.dumpstream' if (!fileExists('core/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml')) { error 'JUnit 4 tests are no longer being run for the core package' }