Skip to content

Instantly share code, notes, and snippets.

@epishan
Last active October 31, 2016 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epishan/1485402c0cc47b70bef5512bedcc1a5e to your computer and use it in GitHub Desktop.
Save epishan/1485402c0cc47b70bef5512bedcc1a5e to your computer and use it in GitHub Desktop.
import hudson.model.*
def q = Jenkins.instance.queue
def JOB_PATTERN = ~/^tools.merge_master.*$/; //find all jobs starting with "MY_JOB".
(q.items.findAll { it.task.name =~ JOB_PATTERN }).each {
println ("Cancelling task " + it.task.name);
q.cancel(it.task)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment