Created
March 28, 2017 08:08
-
-
Save tizki/b6a56bfa6443937ecf906fa91c5e2c23 to your computer and use it in GitHub Desktop.
The scripts show how to enable and disable all jobs in a Jenkins folder
This file contains hidden or 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
//The scripts show how to enable and disable all jobs in a Jenkins folder | |
def jenkins = Jenkins.getInstance() | |
def folder = jenkins.getItem("test-folder") | |
def jobs = folder.getAllJobs() | |
disableJobs = jobs.each { | |
println "Disabled: ${it.isDisabled()}" | |
//disable | |
it.disable() | |
println "Disabled: ${it.isDisabled()}" | |
} | |
enableJobs = jobs.each{ | |
println "Enabled: ${!it.isDisabled()}" | |
//enable | |
it.enable() | |
println "Enabled: ${!it.isDisabled()}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment