Created
October 17, 2017 07:02
-
-
Save aetos382/ae9c13404ddd8bc2dd07953eac96793b to your computer and use it in GitHub Desktop.
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
Jenkins.instance.getItem("projectName").items.each { | |
it.setDisabled(true) | |
try { | |
build = it.getLastBuild() | |
while (build != null) { | |
previousBuild = build.previousBuild | |
println("deleting ${build.fullDisplayName} (${build.number})") | |
try { | |
build.deleteArtifacts() | |
build.delete() | |
} | |
catch (Exception ex) { | |
println(ex) | |
} | |
build = previousBuild | |
} | |
} | |
finally { | |
it.setDisabled(false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment