Skip to content

Commit

Permalink
added change to check child job abort
Browse files Browse the repository at this point in the history
  • Loading branch information
annaibm committed Nov 1, 2024
1 parent f4909f4 commit c12b145
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -793,14 +793,23 @@ def runTest( ) {
}
}
} catch (Exception e) {
handleException(e)
} finally {
// Cleanup: Terminate any running processes if the build was aborted
if (wasAborted || currentBuild.result == 'ABORTED') {
echo "Cleaning up any running child jobs due to build being aborted..."
// Add logic to abort child processes if necessary
// Example: sh "pkill -f 'your_process_name'"
}
println("Exception: " + e.toString())
if (e.toString().contains("FlowInterruptedException")) {
currentBuild.result = 'ABORTED'
} else {
currentBuild.result = 'FAILURE'
}

} finally {
if (currentBuild.rawBuild.isInterrupted()) {
println("Parent job is aborted. Aborting any child jobs...")
// Add code to abort child jobs, if any are running
for (child in currentBuild.rawBuild.getDownstreamBuilds()) {
if (child.isBuilding()) {
child.doStop()
}
}
}
}

if (params.CODE_COVERAGE) {
Expand Down

0 comments on commit c12b145

Please sign in to comment.