Created
April 21, 2020 21:04
-
-
Save evbruno/a0f07f4a976e2259da04090f1e662d05 to your computer and use it in GitHub Desktop.
Delete Jenkins builds
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 subject = "job name" | |
Jenkins.instance.getAllItems(Job.class).each { job -> | |
if (job.toString().contains(subject)) { | |
println " > " + job.name | |
job.builds.each { build -> | |
println ' >> ' + build.number + ' > ' + build.result + ' > ' + build.getDescription() | |
// | |
//if (build.number < 100) build.delete() | |
//if (Result.SUCCESS != build.result) build.delete() | |
} | |
job.nextBuildNumber = 1 | |
job.save() | |
} | |
} | |
subject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment