Skip to content

Commit af14862

Browse files
committed
Added flag to abort build
1 parent 1149bf1 commit af14862

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

buildenv/jenkins/openjdk_tests

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ timestamps{
414414
}
415415

416416
def runTest() {
417+
boolean wasAborted = false
417418
try {
418419
def retry_count = 0
419420
def sleep_time = 180
@@ -491,17 +492,18 @@ def runTest() {
491492
println("Exception: " + e.toString())
492493
// build result may not be updated correctly at the moment (see https://issues.jenkins.io/browse/JENKINS-56402)
493494
// if there is an exception, set currentBuild.result to ABORTED/FAILURE
494-
if (e.toString().contains("FlowInterruptedException") || currentBuild.rawBuild.getExecutor()?.isInterrupted()) {
495-
currentBuild.result = 'ABORTED'
495+
if (e.toString().contains("FlowInterruptedException")) {
496+
wasAborted = true
497+
currentBuild.result = 'ABORTED'
496498
echo "Build aborted by user or another trigger."
497499
} else {
498500
currentBuild.result = 'FAILURE'
499501
}
500502

501503
} finally {
502-
if (currentBuild.rawBuild.getExecutor()?.isInterrupted()) {
504+
if (wasAborted) {
503505
currentBuild.result = 'ABORTED'
504-
echo "Build aborted by user or another trigger."
506+
echo "aborted build."
505507
}
506508
if (params.SLACK_CHANNEL) {
507509
timeout(time: 5, unit: 'MINUTES') {

0 commit comments

Comments
 (0)