Skip to content
Permalink
Browse files
adds workaround for JENKINS-17116
  • Loading branch information
Øyvind Harboe authored and Øyvind Harboe committed Apr 10, 2015
1 parent d6b223b commit 0eff041d3388cc8a2dba3367f3f0b131d19c018c
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java
@@ -126,6 +126,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;
@@ -1913,6 +1923,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 0eff041

Please sign in to comment.