Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save GuilhermeBarile/2c97642b43e21489cf2a59e96c0884b0 to your computer and use it in GitHub Desktop.

Select an option

Save GuilhermeBarile/2c97642b43e21489cf2a59e96c0884b0 to your computer and use it in GitHub Desktop.

Revisions

  1. @nextrevision nextrevision created this gist Dec 3, 2015.
    10 changes: 10 additions & 0 deletions deleteJenkinsJobs.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    import jenkins.model.*

    def matchedJobs = Jenkins.instance.items.findAll { job ->
    job.name =~ /my_regex_here/
    }

    matchedJobs.each { job ->
    println job.name
    //job.delete()
    }