如何重置詹金斯的内部版本号? [英] 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屋!
查看全文