如何在詹金斯中重置内部版本号? [英] How to reset build number in jenkins?
本文介绍了如何在詹金斯中重置内部版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Jenkins 和 Gradle 来构建我的 Java 项目.
I am using Jenkins and Gradle to build my java project.
每次构建项目时,我都会在 Jenkins 屏幕上看到一个新的构建编号.
Every time I build my project, I get a new build number on the Jenkins screen.
以下是我的 Jenkins 构建信息:
The following is my Jenkins build info:
Success > Console Output #96 03-Jan-2014 15:35:08
Success > Console Output #95 03-Jan-2014 15:27:29
Failed > Console Output #94 03-Jan-2014 15:26:16
Failed > Console Output #93 03-Jan-2014 15:25:01
Failed > Console Output #92 03-Jan-2014 15:23:50
Success > Console Output #91 03-Jan-2014 12:42:32
Success > Console Output #90 03-Jan-2014 12:02:45
我想重置 Jenkins 内部版本号,例如:
I want to reset the Jenkins build number like:
Success > Console Output #1 03-Jan-2014 12:02:45
如何在 Jenkins 中重置内部版本号?
How can I reset the build number in Jenkins?
推荐答案
可以从 groovy 脚本控制台更轻松地完成.转到 http://your-jenkins-server/script在脚本窗口输入:
Can be easier done from groovy script console . Go to http://your-jenkins-server/script In script window enter:
item = Jenkins.instance.getItemByFullName("your-job-name-here")
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build ->
build.delete()
}
item.updateNextBuildNumber(1)
这篇关于如何在詹金斯中重置内部版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文