覆盖 Hudson 中的内部版本号
如何覆盖 Hudson 内部版本号?这听起来像是一个简单的问题,但事实上并非如此。
主要目标是将 SVN 修订号作为内部版本号。所以我设置了环境。变种使用适当的插件,我有:
BUILD_NUMBER = ${SVN_REVISION}.${BUILD_ID}
BUILD_TAG = ${JOB_NAME}.${BUILD_NUMBER}
BUILD_NUMBER = ${JOB_URL}.${BUILD_NUMBER}
并且在 Hudson 日志中 BUILD_NUMBER 实际上被覆盖:
BUILD_NUMBER = 32.2010-11-19_14-10-48
BUILD_TAG = hudson-FF.课程管理-32.2010-11-19_14-10-48
BUILD_URL = http://dot-服务器:8080/job/FF.Course%20Management/32.2010-11-19_14-10-48
但 Hudson 仍然使用自己的编号,并声称内部版本号是 70,而我希望它是 32(如上面的示例所示)。
How can I override Hudson build number? It sounds like an easy question, but in fact it is not.
Main main goal is to have the SVN revision number as the build number. So I set the env. var. with appropriate plug in and i have:
BUILD_NUMBER = ${SVN_REVISION}.${BUILD_ID}
BUILD_TAG = ${JOB_NAME}.${BUILD_NUMBER}
BUILD_NUMBER = ${JOB_URL}.${BUILD_NUMBER}
and in Hudson log the BUILD_NUMBER is actully overridden:
BUILD_NUMBER = 32.2010-11-19_14-10-48
BUILD_TAG = hudson-FF.Course Management-32.2010-11-19_14-10-48
BUILD_URL = http://dot-servers:8080/job/FF.Course%20Management/32.2010-11-19_14-10-48
but Hudson still uses its own number and claims that the build number is, let's say, 70 and I wanted it to be 32 (as in the above example).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
有一个插件可以设置下一个版本号一份工作。但这不是您正在寻找的功能,因为工作已经开始。您应该查看 Hudson 的指纹功能。另一个不错的插件,可能对您有帮助是 描述设置器插件 。请查看此问题,以更好地了解内部版本号。
There is a plugin to set the next build number of a job. But this is not the functionality you are looking for, since the job is already started. You should have a look at the fingerprint feature from Hudson. Another nice plugin, that might help you is the description setter plugin. Have a look at this issue to get a better understanding about build numbers.
我找到了一种方法,只需更改 jobs/project/nexBuildNumber 中的版本号,然后进入 Manage Hudson 选项卡,然后单击“从磁盘重新加载配置”,然后它将加载新的覆盖版本号。
I found a way, just change the version number in jobs/project/nexBuildNumber, and then got Manage Hudson tab, and click on 'Reload Configuration from Disk', then it will load the new overridden build number.
当您说哈德逊使用自己的号码时,您的意思是在左侧栏上吗?
如果是这样,可能是因为当您设置它时(我猜测是通过构建>执行 shell 脚本),该数字已经用于创建构建本身,因此它使用 70 而不是 32。
但是,由于您更改了执行 shell 脚本中的数字,因此任何使用构建号之后的内容都应该使用 32。
When you say Hudson uses its own number, do you mean on the left sidebar?
If so, it is probably because by the time you set it (which I am guessing is through the build > execute shell script), the number has already been used to create the build itself, and therefore it uses 70 instead of 32.
However, since you change the number in the Execute shell script, anything that uses the build number after that should use 32.
我改变了主意。我没有更改 Hudson 的内部版本号,而是使用它来版本化我的二进制文件。所以现在我有一个具有这样版本控制的二进制文件:
1.2.${SVN_REVISION}.${BUILD_NUMBER}
并将其与描述设置器插件相结合,我可以在任何地方反映每个数字。
感谢您的帮助。
I changed my mind. Instead of changing the Hudson's internal build number I use it to version my binaries. So now I have a binary with such versioning:
1.2.${SVN_REVISION}.${BUILD_NUMBER}
and combining it with the Description Setter plugin I can reflect each number everywhere.
Thanks for your help.
我已经在 Team City CI 中完成了此操作,它与 Hudson 非常相似。
在命令行参数中设置 -DSVN_REVISION=123 -DBUILD_NUMBER=456 以运行 Maven。这应该覆盖这些值。
在 Team City 中,我使用 Maven BuildNumber 插件和 -DscmBranch=/releases/2.0.0 -DbuildNUmber=233 来构建我们的版本,因为该插件仅支持 /tags、/branches 和 /trunk 文件夹名称,但我们有一个 /releases 文件夹。这会覆盖 scm 插件中的值。
I've done this in Team City CI, which is similar enough to Hudson.
Set -DSVN_REVISION=123 -DBUILD_NUMBER=456 in your command line parameters to run Maven with. This should override those values.
In Team City I use the Maven BuildNumber Plugin with -DscmBranch=/releases/2.0.0 -DbuildNUmber=233 to build our releases since the plugin only supports /tags, /branches, and /trunk folder names, but we have a /releases folder. This overrides the values from the scm plugin.