Jenkins 定期构建 - 计划 [英] Jenkins Build Periodically - Schedule

查看:31
本文介绍了Jenkins 定期构建 - 计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望每 15 分钟定期构建一次.我在网上查了一下,我正在使用这个时间表:*/15 * * * *

I am looking to build periodically every 15 minutes. I have looked online and I am using this schedule: */15 * * * *

Jenkins 告诉我使用 H/15 * * * * 而不是 */15 * * * *

Jenkins is telling me to spread load evenly by using H/15 * * * * rather than */15 * * * *

谁能告诉我使用 H 而不是 * 的区别?

Could someone tell me the difference between using H instead of *?

推荐答案

是的.从构建触发器定期构建计划 → 内联帮助:

Yes. From the Build TriggersBuild periodicallySchedule → inline help:

为了允许定期调度的任务在系统上产生均匀的负载,应尽可能使用符号 H(代表哈希").例如,对十几个日常工作使用 0 0 * * * 会导致午夜出现大幅峰值.相比之下,使用 H H * * * 仍然会每天执行每个作业一次,但不是同时执行一次,更好地使用有限的资源.

To allow periodically scheduled tasks to produce even load on the system, the symbol H (for "hash") should be used wherever possible. For example, using 0 0 * * * for a dozen daily jobs will cause a large spike at midnight. In contrast, using H H * * * would still execute each job once a day, but not all at the same time, better using limited resources.

H 符号可以与范围一起使用.例如,H H(0-7) * * * 表示 12:00 AM(午夜)到 7:59 AM 之间的某个时间.您还可以将步长间隔与 H 一起使用,有或没有范围.

The H symbol can be used with a range. For example, H H(0-7) * * * means some time between 12:00 AM (midnight) to 7:59 AM. You can also use step intervals with H, with or without ranges.

H 符号可以被认为是一个范围内的随机值,但它实际上是作业名称的哈希,而不是随机函数,因此对于任何给定的值都保持稳定项目.

The H symbol can be thought of as a random value over a range, but it actually is a hash of the job name, not a random function, so that the value remains stable for any given project.

请注意,对于月份字段,*/3H/3 等短周期不会在大多数月份结束时始终如一地工作,因为可变的月份长度.例如,*/3 将在长月的第 1、4、...31 天运行,然后在下个月的第二天再次运行.哈希值始终在 1-28 范围内选择,因此 H/3 将在月末运行 3 到 6 天之间产生间隔.(较长的周期也会有不一致的长度,但效果可能相对不太明显.)

Beware that for the day of month field, short cycles such as */3 or H/3 will not work consistently near the end of most months, due to variable month lengths. For example, */3 will run on the 1st, 4th, …31st days of a long month, then again the next day of the next month. Hashes are always chosen in the 1-28 range, so H/3 will produce a gap between runs of between 3 and 6 days at the end of a month. (Longer cycles will also have inconsistent lengths but the effect may be relatively less noticeable.)

空行和以 # 开头的行将作为注释被忽略.

Empty lines and lines that start with # will be ignored as comments.

另外,@yearly@annually@monthly@weekly@支持daily@midnight@hourly 作为方便的别名.这些使用哈希系统进行自动平衡.例如,@hourlyH * * * * 相同,可以表示一小时内的任何时间.@midnight 实际上是指 12:00 AM 到 2:59 AM 之间的某个时间.

In addition, @yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly are supported as convenient aliases. These use the hash system for automatic balancing. For example, @hourly is the same as H * * * * and could mean at any time during the hour. @midnight actually means some time between 12:00 AM and 2:59 AM.

例子:

# every fifteen minutes (perhaps at :07, :22, :37, :52)
H/15 * * * *
# every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24)
H(0-29)/10 * * * *
# once every two hours every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM)
H 9-16/2 * * 1-5
# once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *

这篇关于Jenkins 定期构建 - 计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆