From ccaaf0e2ab307766ceaf6bb81d543db198d55c74 Mon Sep 17 00:00:00 2001 From: Anna Babu Palathingal <148897727+annaibm@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:48:21 -0400 Subject: [PATCH] Abort child jobs on build interrupt - Added a check for current build result, to determine if it is aborted. - If the build is aborted, terminate the child jobs by breaking the loop. Signed-off-by: Anna Babu Palathingal --- buildenv/jenkins/JenkinsfileBase | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildenv/jenkins/JenkinsfileBase b/buildenv/jenkins/JenkinsfileBase index 24c8b3ec68..98ac6ae3f7 100644 --- a/buildenv/jenkins/JenkinsfileBase +++ b/buildenv/jenkins/JenkinsfileBase @@ -765,6 +765,10 @@ def runTest( ) { } for (int i = 1; i <= ITERATIONS; i++) { echo "ITERATION: ${i}/${ITERATIONS}" + if (currentBuild.result == 'ABORTED') { + echo "Build is aborted. Stop the loop...." + break + } if (env.SPEC.contains('linux') && !(LABEL.contains('ci.agent.dynamic') && CLOUD_PROVIDER == 'azure') && (BUILD_LIST != "external")) { // Add an additional 10 second timeout due to issue: https://github.com/adoptium/temurin-build/issues/2368#issuecomment-756683888 wrap([$class: 'Xvfb', autoDisplayName: true, timeout:20]) {