Jenkins:重置 job build number

在调试jenkins job时会产生很多fail的build,很多红色的X还是很碍眼的,job调试成功后就可以重置build number了。

步骤:

  1. 点击jenkins小老头图标 -> 管理Jenkins

  2. 管理Jenkins页面找到Tools and Actions -> scripts console工具

  3. 运行下面代码

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

posted @ 2023-08-01 18:48  Apple Zhang  阅读(270)  评论(0编辑  收藏  举报