Skip to content
Permalink
Browse files
Merge pull request #224 from zylin/jenkins-17116-workaround
adds workaround for JENKINS-17116
  • Loading branch information
rsandell committed May 4, 2015
2 parents afa1cff + 0eff041 commit a9de6534418bbeddf0ae449bae33b0a28b510ed5
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java
@@ -128,6 +128,16 @@
public class GerritTrigger extends Trigger<AbstractProject> {

private static final Logger logger = LoggerFactory.getLogger(GerritTrigger.class);

/**
* Default 'true'.
*
* As a workaround for https://issues.jenkins-ci.org/browse/JENKINS-17116 it is
* possible to only remove pending jobs from the queue, but not to
* abort running jobs by setting this to 'false'.
*/
public static final String JOB_ABORT = GerritTrigger.class.getName() + "_job_abort";

//! Association between patches and the jobs that we're running for them
private transient RunningJobs runningJobs = new RunningJobs();
private List<GerritProject> gerritProjects;
@@ -1931,6 +1941,12 @@ private void cancelJob(GerritTriggeredEvent event) {
Queue.getInstance().cancel(item);
}
}

String workaround = System.getProperty(JOB_ABORT);
if ((workaround != null) && workaround.equals("false")) {
return;
}

// Interrupt any currently running jobs.
Jenkins jenkins = Jenkins.getInstance();
assert jenkins != null;

0 comments on commit a9de653

Please sign in to comment.