Skip to content

Commit 8c95103

Browse files
committed
Added flag to abort build
1 parent 6fb9bcc commit 8c95103

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
@@ -413,6 +413,7 @@ timestamps{
413413
}
414414

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

500502
} finally {
501-
if (currentBuild.rawBuild.getExecutor()?.isInterrupted()) {
503+
if (wasAborted) {
502504
currentBuild.result = 'ABORTED'
503-
echo "Build aborted by user or another trigger."
505+
echo "aborted build."
504506
}
505507
if (params.SLACK_CHANNEL) {
506508
timeout(time: 5, unit: 'MINUTES') {

0 commit comments

Comments
 (0)