try-catch block was bogus. Trying to switch to Declarative, with workaround.
-properties([buildDiscarder(logRotator(numToKeepStr: '20'))])
-timeout(time: 1, unit: 'HOURS') {
- node('docker') {
- checkout scm
- docker.image('maven:3.3.9-jdk-8').inside {
+pipeline {
+ options {
+ buildDiscarder(logRotator(numToKeepStr: '20'))
+ timeout(time: 1, unit: 'HOURS')
+ }
+ agent {
+ docker {
+ image 'maven:3.3.9-jdk-8'
+ label 'docker'
+ }
+ }
+ stages {
+ stage('main') {
+ steps {
sh 'mvn -B -Prun-plugin-pom-its clean verify'
}
- try { // TODO cannot use Declarative due to JENKINS-42478
+ post {
+ failure {
+ catchError { // JENKINS-42478: in case the failure occurred prior to getting the node
archiveArtifacts artifacts: 'target/its/*/build.log', allowEmptyArchive: true
- } catch (e) {
- throw e
+ }
+ }
+ }
}
}
}
