1、重置单个JOB的构建历史
item = Jenkins.instance.getItemByFullName("your-job-name-here")
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build ->
build.delete()
}
item.updateNextBuildNumber(1)
2、重置所有JOB的构建历史
Jenkins.instance.getAllItems(AbstractProject.class).each {
item = Jenkins.instance.getItemByFullName(it.fullName)
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build ->
build.delete()
}
item.updateNextBuildNumber(1)
}
3、重置所有JOB的构建历史
Jenkins.instance.allItems.each() {
item -> item.builds.each() {
build -> build.delete()
}
item.updateNextBuildNumber(1)
}
 
 
 
05-28 13:51