//项目名称 def projectName = "jk-hr-talent" //删除小于64的构建历史 def maxNumber = 9 Jenkins.instance.getItemByFullName(projectName).builds.findAll { it.number <= maxNumber }.each { it.delete() }