Skip to content

Instantly share code, notes, and snippets.

@madchap
Created April 30, 2020 08:10
Show Gist options
  • Save madchap/1ccbb544619d78f877c18afdaf40b1e7 to your computer and use it in GitHub Desktop.
Save madchap/1ccbb544619d78f877c18afdaf40b1e7 to your computer and use it in GitHub Desktop.
Cancel all Jenkins queued builds
import hudson.model.*
import jenkins.model.Jenkins
def q = Jenkins.instance.queue
q.items.findAll { it.task.name.startsWith('your_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