Skip to content

Instantly share code, notes, and snippets.

@cterrykenzan
Created April 13, 2018 16:49
Show Gist options
  • Save cterrykenzan/02dfb1104f47396bf2b2086d502b9098 to your computer and use it in GitHub Desktop.
Save cterrykenzan/02dfb1104f47396bf2b2086d502b9098 to your computer and use it in GitHub Desktop.
jenkins dsl delete jobs with regex
// https://gist.github.com/nextrevision/d11b2df4e8b229c6855b
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /my_regex_here/
}
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