Created
March 4, 2015 22:26
-
-
Save petersellars/8cb788ab94e3b95ecd64 to your computer and use it in GitHub Desktop.
Jenkins Groovy Scripts: Activate Chuck Norris Plugin for all Jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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