Jenkins:重置 job build number
在调试jenkins job时会产生很多fail的build,很多红色的X还是很碍眼的,job调试成功后就可以重置build number了。
步骤:
-
点击jenkins小老头图标 -> 管理Jenkins
-
在管理Jenkins页面找到Tools and Actions -> scripts console工具
-
运行下面代码
def jobName = "需重置build号的job名称"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.save()
参考:https://linuxhelp4u.blogspot.com/2018/03/how-to-clean-or-reset-build-numbers-in.html