Skip to content

Instantly share code, notes, and snippets.

@loivis
Last active January 17, 2018 10:18
Show Gist options
  • Save loivis/93ef550af01ad9dc74da24ce9811ee41 to your computer and use it in GitHub Desktop.
Save loivis/93ef550af01ad9dc74da24ce9811ee41 to your computer and use it in GitHub Desktop.
// delete build history in range and reset build number
fullJobName = "full/job/name"
start = 1
end = 10
nextBuildNumber = 1
item = Jenkins.instance.getItemByFullName(fullJobName)
item.builds.each() { build ->
if (build.number >= start && build.number <= end) {
println("deleting build: " + build.number)
build.delete()
}
}
item.updateNextBuildNumber(nextBuildNumber)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment