Skip to content

Instantly share code, notes, and snippets.

@mshuler
Created October 8, 2015 20:42
Show Gist options
  • Save mshuler/1610e4091458b31612b2 to your computer and use it in GitHub Desktop.
Save mshuler/1610e4091458b31612b2 to your computer and use it in GitHub Desktop.
Clear Jenkins queue of all jobs starting with 'job_name_' (use { it.task.name }.each for clearing the entire queue)
import jenkins.model.*
def q = Jenkins.instance.queue
q.items.findAll { it.task.name.startsWith('job_name_') }.each { q.cancel(it.task) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment