您如何使Jenkins Poll SCM Schedule中的H实际上是随机的 [英] How do you Make the H in Jenkins Poll SCM Schedule actually random
问题描述
我正在运行Jenkins 1.565.1
I running Jenkins 1.565.1
文档表明H(哈希)函数是项目名称的随机哈希.
The docs indicate the H (hash) function to be a random hash of the project name.
在我看来,这似乎并不正确.我将SCM轮询设置为每4小时
This does not appear to be true in my case. I set SCM polling to be every 4 hours
H H/4 * * *
对于许多项目,它们被安排在
for a number of projects and they get scheduled at
12:00:31
12:00:58
12:00:23
12:00:14
这似乎根本不是随机的!我该如何随机启动它们,并每4个小时检查一次.
This does not appear to be random at all! Ho do I start them at a random time, and check back every 4 hours.
如果我将公式更改为
H H/3 * * *
或
H H * * *
在12:00分钟内,它仍具有相同的开始时间.
It still has the same starting time, within the 12:00 minute.
请注意,此问题仅在SCM轮询中存在,定期构建"中的时间表与所记录的相同.
Note that this problem exists only in SCM polling, the same schedule in "Build Periodically" behaves as documented.
推荐答案
如果您可能不会失去小时的随机性,则可以尝试:
If you don't might losing the randomness on the hours, you could try:
H */4 * * *
对我有用.
我不得不亲自检查文档,因为我只在分钟位置使用了"H",但是实际上您的语法似乎是合适的. 在线文档提供了以下示例:
I had to check the documentation myself, because I had used "H" only with the minutes position, but it looks like your syntax would be appropriate, actually. The online doc provides the following examples:
# every fifteen minutes (perhaps at :07, :22, :37, :52)
H/15 * * * *
# once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *
也可能是您的工作名称的随机函数在0处四舍五入...您可以尝试重命名工作以查看是否获得更好的结果吗?
It might also be that the random function for your job name turns out to round at 0... Can you try renaming your job and see if you get better results ?
这篇关于您如何使Jenkins Poll SCM Schedule中的H实际上是随机的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!