Skip to content

Instantly share code, notes, and snippets.

@kylemanna
Last active May 8, 2019 19:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemanna/889b2441eb434a0323e0f313d4a2250e to your computer and use it in GitHub Desktop.
Save kylemanna/889b2441eb434a0323e0f313d4a2250e to your computer and use it in GitHub Desktop.
def jobName = "job/staging"
def maxNumber = 400
// delete all builds before maxNumber
Jenkins.instance.getItemByFullName(jobName).builds.findAll { it.number <= maxNumber }.each {
it.delete()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment