return false;
}
@Override
public void stop(Throwable cause) {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
return;
}
Queue q = jenkins.getQueue();
// if the build is still in the queue, abort it.
// BuildTriggerListener will report the failure, so this method shouldn't call getContext().onFailure()
for (Queue.Item i : q.getItems()) {
BuildTriggerAction bta = i.getAction(BuildTriggerAction.class);
if (bta!=null && bta.getStepContext().equals(getContext())) {
q.cancel(i);
}
}
// if there's any in-progress build already, abort that.
// when the build is actually aborted, BuildTriggerListener will take notice and report the failure,
// so this method shouldn't call getContext().onFailure()
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
Queue.Executable exec = e.getCurrentExecutable();
if (exec instanceof Run) {
Run<?,?> b = (Run) exec;