Skip to content

Instantly share code, notes, and snippets.

@phaneesh
Created December 24, 2024 04:51
Show Gist options
  • Save phaneesh/b33efdc8d19c0454d57698b11e184877 to your computer and use it in GitHub Desktop.
Save phaneesh/b33efdc8d19c0454d57698b11e184877 to your computer and use it in GitHub Desktop.
jenkins-delete-jobs.groovy
import jenkins.model.*
String[] toBeDeletedJobs = []
def matchedJobs = Jenkins.instance.items.findAll { job ->
toBeDeletedJobs.contains(job.name)
}
matchedJobs.each { job ->
println job.name
job.delete()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment