代码改变世界

[Jenkins] 批量删除构建历史

2018-09-20 14:18  shaobin0604  阅读(3905)  评论(0编辑  收藏  举报

Manage Jenkins -> Script Console

def jobName = "Some_Job_Name"
def maxNumber = 64

Jenkins.instance.getItemByFullName(jobName).builds.findAll {
  it.number <= maxNumber
}.each {
  it.delete()
}