重置Jenkins的构建历史

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)
}  
 
 
 
posted @ 2019-11-24 21:34  煦色韶光  阅读(1546)  评论(0编辑  收藏  举报