Created
August 20, 2018 08:54
-
-
Save matthiasbaldi/a19d1d79a905184f285ebe235c0f053a to your computer and use it in GitHub Desktop.
Jenkins set PeriodicFolderTrigger for multiple Items
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
def counter = 0 | |
for (f in Jenkins.instance.getAllItems(jenkins.branch.MultiBranchProject.class)) { | |
if (f.parent instanceof jenkins.branch.OrganizationFolder) { | |
// managed by org folder, leave alone | |
continue; | |
} | |
if (f.name.matches(/.*api.*/)) { | |
println "set config for: ${f.name}" | |
// addTrigger will replace an existing one | |
f.addTrigger(new com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger("30m")); | |
counter++ | |
} | |
} | |
println "---------------------------------------------" | |
println "updated elements: ${counter}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment