问题
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