Skip to content

Instantly share code, notes, and snippets.

@phaneesh
Created July 26, 2019 15:27
Show Gist options
  • Save phaneesh/c4987d9a5b9a88a88e9ae5655fb4cd46 to your computer and use it in GitHub Desktop.
Save phaneesh/c4987d9a5b9a88a88e9ae5655fb4cd46 to your computer and use it in GitHub Desktop.
Jenkins - Set Build History Retention
import hudson.model.*
import hudson.maven.MavenModuleSet
import hudson.tasks.*
Hudson.instance.items.each {
if(it instanceof MavenModuleSet) {
if(it.getBuildDiscarder() != null && it.getBuildDiscarder() instanceof LogRotator) {
def l = new LogRotator(365,-1,-1,-1)
it.setBuildDIscarder(l)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment