Skip to content

Commit

Permalink
perhaps try catch should be in node as well
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Mar 3, 2017
1 parent 9937f9b commit b65f81e
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions Jenkinsfile
Expand Up @@ -18,10 +18,10 @@ def failsafeTestReports='target/failsafe-reports/TEST-*.xml'
* Failed and stop the build
* Yet able to create report
*/
try {
timestamps {
timestamps {
ansicolor {
node {
ansicolor {
try {
stage('Checkout') {
info.printNode()
notify.started()
Expand Down Expand Up @@ -63,40 +63,41 @@ try {
// Continue building even when test failure
// Thus -Dmaven.test.failure.ignore is required
sh """./run-clean.sh ./mvnw -e clean package jxr:aggregate\
--batch-mode \
--settings .travis-settings.xml \
--update-snapshots \
-DstaticAnalysis \
-Dchromefirefox \
-DskipFuncTests \
-DskipArqTests \
-Dmaven.test.failure.ignore \
"""
setJUnitPrefix("UNIT", surefireTestReports)

// notify if compile+unit test successful
notify.testResults("UNIT")
archive "**/${jarFiles},**/${warFiles}"
currentBuild.result = 'SUCCESS'
--batch-mode \
--settings .travis-settings.xml \
--update-snapshots \
-DstaticAnalysis \
-Dchromefirefox \
-DskipFuncTests \
-DskipArqTests \
-Dmaven.test.failure.ignore \
"""
setJUnitPrefix("UNIT", surefireTestReports)

// notify if compile+unit test successful
notify.testResults("UNIT")
archive "**/${jarFiles},**/${warFiles}"
currentBuild.result = 'SUCCESS'
}

stage('stash') {
stash name: 'workspace', includes: '**'
}
} catch (e) {
notify.failed()
currentBuild.result = 'FAILURE'
throw e
} finally {
junit allowEmptyResults: true,
keepLongStdio: true,
testDataPublishers: [[$class: 'StabilityTestDataPublisher']],
testResults: "**/${surefireTestReports}"
}
}
}
} catch (e) {
notify.failed()
currentBuild.result = 'FAILURE'
throw e
} finally {
junit allowEmptyResults: true,
keepLongStdio: true,
testDataPublishers: [[$class: 'StabilityTestDataPublisher']],
testResults: "**/${surefireTestReports}"
}


if (currentBuild.result.equals('FAILURE')){
return 1
}
Expand Down

1 comment on commit b65f81e

@seanf
Copy link
Contributor

@seanf seanf commented on b65f81e Mar 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try catch doesn't have to be inside node, but anything using files should, eg the junit step in the try-finally handler.

Please sign in to comment.