Created
April 6, 2021 21:57
-
-
Save prerak-proof/2f7247ab6cb09edb298a05a20e2da456 to your computer and use it in GitHub Desktop.
Jenkins set build discarder
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
processGroup(Jenkins.instance) | |
def processGroup(itemGroup) { | |
itemGroup.items.each { j -> | |
if (j.class.simpleName == "Folder") { | |
processGroup(j) | |
} else { | |
if (j.supportsLogRotator()) { | |
j.setBuildDiscarder(new hudson.tasks.LogRotator(365, 30, 365, 30)) | |
println(j) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment