build: abort previous run if still running
@@ -96,7 +96,7 @@ CMAKE_FLAGS_BASE = [
'KDB_DB_SPEC': '${HOME}/.config/kdb/spec',
'CMAKE_INSTALL_PREFIX': '${WORKSPACE}/system',
'INSTALL_SYSTEM_FILES': 'OFF',
- 'buildDocUMENTATION': 'OFF'
+ 'BUILD_DOCUMENTATION': 'OFF'
]
// TODO Remove -DEPRECATED after #1954 is resolved
@@ -125,6 +125,9 @@ TEST_INSTALL = 'install'
NOW = new Date()
+// If previous run is still running, cancel it
+abortPreviousRun()
+
/*****************************************************************************
* Main Stages
*
@@ -891,3 +894,18 @@ def publishDebianPackages(remote="a7") {
def apiary(input, output) {
sh "apiary preview --path=${input} --output=${output}"
}
+
+def abortPreviousRun() {
+ def exec = currentBuild
+ ?.rawBuild
+ ?.getPreviousBuildInProgress()
+ ?.getExecutor()
+ if(exec) {
+ exec.interrupt(
+ Result.ABORTED,
+ new CauseOfInterruption.UserInterruption(
+ "Aborted by Build#${currentBuild.number}"
+ )
+ )
+ }
+}
