想知道Jenkins内部版本号(BUILD_NUMBER)可以获得的最大数量是多少?我试图在网上找到但是找不到这个信息。
它是无限的还是有一些限制(INT或INT64或其他类型)?
PS:我不是在寻找如何使用以下插件将其重置回#1或#N或将其设置为给定名称(使用Set build name plugin)。 https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin
为了找到它的限制,使用Next Build Number插件 - 当我将构建设置为“65,535”时,它仍然成功地让我获得65536并且我继续将此值增加到999999999(9次),并且它仍然有效,即下一个构建运行了100万,并为少数其他运行/构建获得了有效的Jenkins构建#。
当我尝试将下一个内部版本号设置为:9999999999(10次)时,Jenkins插件使用错误消息(显示我设置的下一个内部版本号不是INTEGER,即不在范围内):
A problem occurred while processing the request. Please check our bug tracker to see if a similar problem has already been reported. If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem. If you think this is a new issue, please file a new issue. When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins. The users list might be also useful in understanding what has happened.
Stack trace
javax.servlet.ServletException: Build number must be an integer
at org.jvnet.hudson.plugins.nextbuildnumber.NextBuildNumberAction.doSubmit(NextBuildNumberAction.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
找到Jenkins BUILD_NUMBER是一个SIGNED Integer数据类型,INT签名限制是:
int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
因此,可以设置或构建Jenkins作业的最后一个值是:2147483647(此处为4个字节)。设置高于此数字的任何内容都将生成预期的INT限制错误。
使用SET NEXT BUILD NUMBER插件注意到以下问题:
发生了什么,虽然提供了一个负值/低于上一个/上一个构建#的值,然后这个插件将该值带入限制范围内,但实际上没有做任何事情/给我预期的BUILD#。当我点击Build Now /每次点击Build Now时,如果点击“Set Next Build Number”来检查值,我注意到框中列出的数字是自动递减的次数我点击“立即构建”(仅当您达到限制时才会发生这种情况),负值/较低值对下一个构建号码没有影响(根据插件文档)。
我通过创建一个新的test_job来测试这个(通过仅保留1个构建来丢弃旧的构建):