File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,7 @@ def runTest( ) {
764
764
}
765
765
}
766
766
try {
767
+ boolean wasAborted = false
767
768
for (int i = 1 ; i <= ITERATIONS ; i++ ) {
768
769
echo " ITERATION: ${ i} /${ ITERATIONS} "
769
770
echo " currentBuild.result: ${ currentBuild.result} "
@@ -793,14 +794,20 @@ def runTest( ) {
793
794
}
794
795
} catch (Exception e) {
795
796
echo " An error occurred: ${ e.message} "
796
- currentBuild. result = ' FAILURE'
797
+ if (e. toString(). contains(" FlowInterruptedException" )) {
798
+ wasAborted = true
799
+ currentBuild. result = ' ABORTED'
800
+ echo " Build aborted by user or another trigger."
801
+ } else {
802
+ currentBuild. result = ' FAILURE'
803
+ }
797
804
} finally {
798
805
// 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
- }
806
+ if (wasAborted || currentBuild. result == ' ABORTED' ) {
807
+ echo " Cleaning up any running child jobs due to build being aborted..."
808
+ // Add logic to abort child processes if necessary
809
+ // Example: sh "pkill -f 'your_process_name'"
810
+ }
804
811
}
805
812
806
813
if (params. CODE_COVERAGE ) {
You can’t perform that action at this time.
0 commit comments