Delete all builds of a specified job
def jobName = "GCP-Core-6.15P3" def job = Jenkins.instance.getItem(jobName) job.getBuilds().each { it.delete() }
Delete all builds of some jobs
for(job in Jenkins.instance.items) { println("Clear builds of "+job.name)
if (job.name.startsWith("GCP")) {
job.getBuilds().each { it.delete() }
}
println("Job "+job.name+" cleaned.")
}
Delete all builds of all jobs
for(job in Jenkins.instance.items) { job.getBuilds().each { it.delete() }
}