How do you Make the H in Jenkins Poll SCM Schedule actually random

橙三吉。 提交于 2019-12-23 04:54:15

问题


I running Jenkins 1.565.1

The docs indicate the H (hash) function to be a random hash of the project name.

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

This does not appear to be random at all! Ho do I start them at a random time, and check back every 4 hours.

If I change the formula to

H H/3 * * *

or

H H * * *

It still has the same starting time, within the 12:00 minute.

Note that this problem exists only in SCM polling, the same schedule in "Build Periodically" behaves as documented.


回答1:


If you don't might losing the randomness on the hours, you could try:

H */4 * * *

which works for me.

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 *

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 ?



来源:https://stackoverflow.com/questions/26513386/how-do-you-make-the-h-in-jenkins-poll-scm-schedule-actually-random

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!