[JENKINS-27039] Option for stage step to cancel older executions #177
Conversation
…ly in this stage and takes its place. Inspired by JENKINS-27039.
This definitely needs coverage in |
@@ -41,6 +41,7 @@ | |||
|
|||
public final String name; | |||
@DataBoundSetter public @CheckForNull Integer concurrency; | |||
@DataBoundSetter public @CheckForNull Boolean eager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean
suffices (especially as the default remains false
).
Looks good so far. Marking WiP pending test coverage (whether written by you or me or someone else). |
As of now, it still cancels jobs with the ABORTED message.
I tried using the FlowExecution.interrupt as well, but the results were the same. Probably did something wrong. I'll try to improve it and write tests as well. |
Logic for handling aborts is a little subtle. Might need to check with a debugger why it is getting |
Wouldnt it be nice to merge this feature and handle the exit status on a different issue (IMHO ABORTED fits well) |
Exit status is a minor issue (mainly consistency with the current behavior), but tests are vital. |
|
What about another parameter to flag a stage as uncancellable? It could serve to define complex-one level semaphores |
Tested locally, it works as advertised. |
Changed my mind. I'm working on a new step ( |
See #355 |
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
I think this has become obsolete; please try out jenkinsci/pipeline-milestone-step-plugin#1 and let us know if it works for you. |
JENKINS-27039
Added
eager
flag to stage step. When a new build enters this stage, it will cancel any running build so that it could proceed on its own. Inspired by @jglick's comment.Example: