Skip to content

Commit 638d78d

Browse files
committed
added was Aborted status flag
1 parent 8c95103 commit 638d78d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

buildenv/jenkins/JenkinsfileBase

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ def runTest( ) {
764764
}
765765
}
766766
try {
767+
boolean wasAborted = false
767768
for (int i = 1; i <= ITERATIONS; i++) {
768769
echo "ITERATION: ${i}/${ITERATIONS}"
769770
echo "currentBuild.result: ${currentBuild.result}"
@@ -793,14 +794,20 @@ def runTest( ) {
793794
}
794795
} catch (Exception e) {
795796
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+
}
797804
} finally {
798805
// 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+
}
804811
}
805812

806813
if (params.CODE_COVERAGE) {

0 commit comments

Comments
 (0)