Skip to content

Instantly share code, notes, and snippets.

@noblige
Forked from dbr/jenkins_delete_failed.groovy
Created November 15, 2019 17:13
Show Gist options
  • Save noblige/adbbeb375f92cfd98f0662cff9271fde to your computer and use it in GitHub Desktop.
Save noblige/adbbeb375f92cfd98f0662cff9271fde to your computer and use it in GitHub Desktop.
Delete failed builds for a job in Jenkins
def job = Jenkins.instance.getItem("the_job_name")
job.getBuilds().each {
if(it.result == Result.FAILURE){
// Delete failed job
it.delete()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment