-
Bug
-
Resolution: Won't Fix
-
Major
-
None
It is currently not possible to cancel an ongoing build from a Groovy script.
The feature is exposed in the UI where the user can cancel an ongoing build. This marks the build as ABORTED and stops the build immediately without processing any more build actions.
Currently it is only possible from a Groovy script to either (1) interrupt the executor (but that marks the jobs a failed despite the arguments) or (2) mark a job aborted (but all build actions a processed).
(1)
build.getExecutor().interrupt(Result.ABORTED)
- This will mark the build failed, even if the API suggests something different.
(2)
build = Thread.currentThread().executable
build.setResult(Result.ABORTED)