【Jenkins】Jenkins删除构建历史
【Jenkins】Jenkins删除构建历史先贴一下脚本删除单个项目的构建历史def jobName = "Mall_qa"def maxNumber = 39Jenkins.instance.getItemByFullName(jobName).builds.findAll {it.number <= maxNumber}.each {it.delete()}删除所有项目的构建历史并重置b
·
Jenkins删除构建历史
先贴一下脚本
删除单个项目的构建历史
def jobName = "Mall_qa"
def maxNumber = 39
Jenkins.instance.getItemByFullName(jobName).builds.findAll {
it.number <= maxNumber
}.each {
it.delete()
}
删除所有项目的构建历史并重置build number
#1
Jenkins.instance.getAllItems(AbstractProject.class).each {
item = Jenkins.instance.getItemByFullName(it.fullName)
item.builds.each() { build ->
build.delete()
}
item.updateNextBuildNumber(1)
}
#2
Jenkins.instance.allItems.each() {
item -> item.builds.each() {
build -> build.delete()
}
item.updateNextBuildNumber(1)
}
具体执行方法
- 打开Jenkins首页
- 选择菜单Manage Jenkins
- 进入Script Console
- 贴入脚本后运行
更多推荐
已为社区贡献1条内容
所有评论(0)