Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thikade/c870a6821437fea6c2c133cf7f499661 to your computer and use it in GitHub Desktop.
Save thikade/c870a6821437fea6c2c133cf7f499661 to your computer and use it in GitHub Desktop.
Groovy script to delete all jenkins jobs that match a regex pattern
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /^OpenShift sample$/
}
matchedJobs.each { job ->
println "jobs: ${job.name}"
//job.delete()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment