Skip to content

Instantly share code, notes, and snippets.

@michbeck100
Created November 18, 2015 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michbeck100/dd2c33e3a4023f05357c to your computer and use it in GitHub Desktop.
Save michbeck100/dd2c33e3a4023f05357c to your computer and use it in GitHub Desktop.
import hudson.maven.MavenModuleSet
hudson.model.Hudson.instance.items.findAll {
job ->
!job.isBuilding() && job.isBuildable() && job instanceof MavenModuleSet
}.each {
job ->
def builds = job.builds.collect {it.getDisplayName()}
println("deleting modules for builds other than " + builds)
job.getModules().each {
module ->
println("module name = " + module.name)
module.builds.each {
build ->
if (!builds.contains(build.getDisplayName())) {
println("deleting build " + build.getDisplayName())
build.delete()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment