Skip to content

Instantly share code, notes, and snippets.

@Zeerg
Created December 21, 2020 20:27
Show Gist options
  • Save Zeerg/44e47f21511e558d37f531444a96c1a7 to your computer and use it in GitHub Desktop.
Save Zeerg/44e47f21511e558d37f531444a96c1a7 to your computer and use it in GitHub Desktop.
Remove bulk jobs using Jenkins Script Console
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ "regex of jobs"
}
matchedJobs.each { job ->
println job.name
//job.delete() Remove the comment to run the purge
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment