如何在詹金斯计划建造? [英] How to schedule a build in Jenkins?
问题描述
如何安排Jenkins构建,使其只能在每天的特定时间构建?
How do I schedule a Jenkins build such that it would be able to build only at specific hours every day?
例如从下午4点开始
0 16 1-7 * *
我了解到,每个月的星期一至星期日,下午0点,下午4点",但是它每分钟都会生成一次:(
I understand that as, "at 0 minutes, at 4 o'clock PM, from Monday to Sunday, every month", however it builds every minute :(
如果有任何建议,我将不胜感激.谢谢!
I would be grateful for any advice. Thanks!
推荐答案
请阅读其他答案和评论,这里有更多的信息以及所描述的细微差别(哈希函数?),我不知道何时回答这个问题.
根据詹金斯自己对计划任务的帮助(?"按钮),指定了5个字段:
According to Jenkins' own help (the "?" button) for the schedule task, 5 fields are specified:
此字段遵循cron的语法(略有不同).具体来说,每行包含5个用TAB或空格分隔的字段:分钟小时DOM DOW
This field follows the syntax of cron (with minor differences). Specifically, each line consists of 5 fields separated by TAB or whitespace: MINUTE HOUR DOM MONTH DOW
我只是试图找一份工作在下午4:42(我的当地时间)启动,并且它与以下版本一起工作,尽管花了大约30秒的时间:
I just tried to get a job to launch at 4:42PM (my approximate local time) and it worked with the following, though it took about 30 extra seconds:
42 16 * * *
如果您想多次,我认为以下方法应该有效:
If you want multiple times, I think the following should work:
0 16,18,20,22 * * *
每天下午4点,6点,8点和10点.
for 4, 6, 8, and 10 o'clock PM every day.
这篇关于如何在詹金斯计划建造?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!