try catch block refinement
@@ -62,12 +62,7 @@ node {
}
}
}
- }catch (e){
- // If there was an exception thrown, the build failed
- currentBuild.result = "FAILED"
- notifyBuild(currentBuild.result)
- throw e
- }
+
// test report on the basis of suite and see report from Allure report plugin &
// see test code coverage report from Coverage report Plugin only when suite choice_test_all and choice_test_python
stage ("Test Report"){
@@ -91,16 +86,19 @@ node {
./build.sh -p
./build.sh --doc-build-test
'''
+ currentBuild.result = "SUCCESSFUL"
}else if (suite == "${choice_test_doc}"){
echo "${choice_test_doc}"
sh '''#!/bin/bash -l
./build.sh --doc-build-test
'''
+ currentBuild.result = "SUCCESSFUL"
}else if (suite == "${choice_test_python}"){
echo "${choice_test_python}"
sh '''#!/bin/bash -l
./build.sh -p
'''
+ currentBuild.result = "SUCCESSFUL"
}
}
}
@@ -117,10 +115,18 @@ node {
}
// Success of failure, always send notifications
+ if(currentBuild.result == 'SUCCESSFUL'){
notifyBuild(currentBuild.result)
}
}
}
+ }catch (e){
+ // If there was an exception thrown, the build failed
+ currentBuild.result = "FAILED"
+ notifyBuild(currentBuild.result)
+ throw e
+ }
+}
def notifyBuild(String buildStatus = 'STARTED'){
// build status of null means successful
