@@ -763,33 +763,45 @@ def runTest( ) {
763
763
echo " env.DISPLAY is ${ env.DISPLAY} "
764
764
}
765
765
}
766
- for (int i = 1 ; i <= ITERATIONS ; i++ ) {
767
- echo " ITERATION: ${ i} /${ ITERATIONS} "
768
- echo " currentBuild.result: ${ currentBuild.result} "
769
- if (currentBuild. result == ' ABORTED' ) {
770
- echo " Build is aborted. Stop the loop...."
771
- break
772
- }
773
- if (env. SPEC . contains(' linux' ) && ! (LABEL . contains(' ci.agent.dynamic' ) && CLOUD_PROVIDER == ' azure' ) && (BUILD_LIST != " external" )) {
774
- // Add an additional 10 second timeout due to issue: https://github.com/adoptium/temurin-build/issues/2368#issuecomment-756683888
775
- wrap([$class : ' Xvfb' , autoDisplayName : true , timeout :20 ]) {
776
- def DISPLAY = sh (
777
- script : ' ps -f | grep \' [X]vfb\' | awk \' {print \$ 9}\' ' ,
778
- returnStdout : true
779
- ). trim()
780
- env. DISPLAY = " ${ DISPLAY} "
781
- echo " env.DISPLAY is ${ env.DISPLAY} "
782
- makeTest(" ${ RUNTEST_CMD} " )
766
+ try {
767
+ for (int i = 1 ; i <= ITERATIONS ; i++ ) {
768
+ echo " ITERATION: ${ i} /${ ITERATIONS} "
769
+ echo " currentBuild.result: ${ currentBuild.result} "
770
+ if (currentBuild. result == ' ABORTED' || currentBuild. result == ' UNSTABLE' ) {
771
+ echo " Build is aborted. Stop the loop...."
772
+ break
773
+ }
774
+ if (env. SPEC . contains(' linux' ) && ! (LABEL . contains(' ci.agent.dynamic' ) && CLOUD_PROVIDER == ' azure' ) && (BUILD_LIST != " external" )) {
775
+ // Add an additional 10 second timeout due to issue: https://github.com/adoptium/temurin-build/issues/2368#issuecomment-756683888
776
+ wrap([$class : ' Xvfb' , autoDisplayName : true , timeout :20 ]) {
777
+ def DISPLAY = sh (
778
+ script : ' ps -f | grep \' [X]vfb\' | awk \' {print \$ 9}\' ' ,
779
+ returnStdout : true
780
+ ). trim()
781
+ env. DISPLAY = " ${ DISPLAY} "
782
+ echo " env.DISPLAY is ${ env.DISPLAY} "
783
+ makeTest(" ${ RUNTEST_CMD} " )
784
+ }
785
+ } else if (BUILD_LIST . contains(' external' )) {
786
+ sshagent (credentials : [" $params . SSH_AGENT_CREDENTIAL " ], ignoreMissing : true ) {
787
+ makeTest(" ${ RUNTEST_CMD} " )
788
+ }
783
789
}
784
- } else if (BUILD_LIST . contains(' external' )) {
785
- sshagent (credentials : [" $params . SSH_AGENT_CREDENTIAL " ], ignoreMissing : true ) {
790
+ else {
786
791
makeTest(" ${ RUNTEST_CMD} " )
787
792
}
788
793
}
789
- else {
790
- makeTest(" ${ RUNTEST_CMD} " )
791
- }
792
- }
794
+ } catch (Exception e) {
795
+ echo " An error occurred: ${ e.message} "
796
+ currentBuild. result = ' FAILURE'
797
+ } finally {
798
+ // Cleanup: Terminate any running processes if the build was aborted
799
+ if (currentBuild. result == ' ABORTED' ) {
800
+ echo " Cleaning up any running child jobs due to build being aborted..."
801
+ // Implement your logic to abort child processes if necessary
802
+ // Example: sh "pkill -f 'your_process_name'" to kill a specific process
803
+ }
804
+ }
793
805
794
806
if (params. CODE_COVERAGE ) {
795
807
echo ' Generating Code Coverage Reports...'
0 commit comments