Skip to content

Instantly share code, notes, and snippets.

@petersellars
Created March 4, 2015 22:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petersellars/8cb788ab94e3b95ecd64 to your computer and use it in GitHub Desktop.
Save petersellars/8cb788ab94e3b95ecd64 to your computer and use it in GitHub Desktop.
Jenkins Groovy Scripts: Activate Chuck Norris Plugin for all Jobs
import jenkins.model.*
for(item in Jenkins.instance.items) {
println("job $item.name")
if (!(item.class == org.jenkinsci.plugins.workflow.job.WorkflowJob)) {
chuck_activated = false
for (publisher in item.publishersList) {
if (publisher.descriptor.displayName == "Activate Chuck Norris")
chuck_activated = true
}
println "Chuck activated " + chuck_activated
if (!chuck_activated) {
println "!!!Activating Chuck!!!"
item.publishersList.replace(new hudson.plugins.chucknorris.CordellWalkerRecorder());
}
}
println ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment