Skip to end of metadata
Go to start of metadata

This script activates Chuck Norris plugin for all jobs in your Jenkins server


import jenkins.model.*


for(item in Jenkins.instance.items) {
     println("job $item.name")
     item.publishersList.replace(new  hudson.plugins.chucknorris.CordellWalkerRecorder());
}
  • No labels

5 Comments

    1. Can you just run the above in the Groovy console?

  1. You can run in main Jenkins Script Console or from System Groovy Script (groovy plugin) from Jenkins job.

  2. Just a little modification to avoid errors when property does not exists (smile)


    import jenkins.model.*

    for(item in Jenkins.instance.items) {
        println("job $item.name")
          if (item.hasProperty('publishersList'))
            item.publishersList.replace(new  hudson.plugins.chucknorris.CordellWalkerRecorder());
    }