Jenkins 有三种类型的构建触发器,如下图:

  • Build after other projects are built:在其他项目构建后构建;
  • Build periodically:定时构建;
  • Poll SCM:定时检查代码更新,如果有更新则构建。

其中“Build periodically”和“Poll SCM”使用的是Cron,帮助文档如下:

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
MINUTE Minutes within the hour (0–59)
HOUR The hour of the day (0–23)
DOM The day of the month (1–31)
MONTH The month (1–12)
DOW The day of the week (0–7) where 0 and 7 are Sunday.

To specify multiple values for one field, the following operators are available. In the order of precedence,

  • * specifies all valid values
  • M-N specifies a range of values
  • M-N/X or */X steps by intervals of X through the specified range or whole valid range
  • A,B,...,Z enumerates multiple values

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.

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.

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.

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.

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.

Examples:

 # 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+PowerShell持续集成环境搭建(七)构建触发器的更多相关文章

  1. Jenkins+PowerShell持续集成环境搭建(六)参数化构建

    参数化构建可以应用于动态绑定源码地址等情况. 勾选“This build is parameterized”: 如果需要动态绑定源码地址,参考: 配置完成后构建项目变成:

  2. Jenkins+PowerShell持续集成环境搭建(一)前期准备

    0. 系统要求 Windows Server:本文章使用的为Windows Server 2012 JDK:本文章使用为JDK 1.8 Windows PowerShell:本文章使用为PowerSh ...

  3. Jenkins+PowerShell持续集成环境搭建(四)常用PowerShell命令

    0. 修改执行策略 Jenkins执行PowerShell脚本,需要修改其执行策略.以管理员身份运行PowerShell,执行以下脚本: Set-ExecutionPolicy Unrestricte ...

  4. Jenkins+PowerShell持续集成环境搭建(八)邮件通知

    1. 默认邮件功能: Jenkins自带的邮件功能比较简单,配置如下: 设置默认发件人地址: 2. Email Extension Plugin 为了能够更加灵活地使用邮件功能,需要安装Email E ...

  5. Jenkins+PowerShell持续集成环境搭建(五)SSRS项目

    部署SSRS项目的原理是使用ReportingService2005类的方法实现rdl文件上传等功能. 上传rdl文件的脚本示例: $username="Victor"; $pas ...

  6. Jenkins+PowerShell持续集成环境搭建(三)Web项目

    1. 新建一个名字为HelloWorld.Web的Freesyle项目: 2. 配置源码管理: 3. 编译配置: 版本:选择MSBuild4 文件:D:\CI\Config\HelloWorld.We ...

  7. Jenkins+PowerShell持续集成环境搭建(二)控制台项目

    1. 新建一个名字为HelloWorld.Console的Freesyle项目: 2. 配置源码管理: 3. 编译配置: 版本:选择MSBuild4 文件:D:\CI\Config\HelloWorl ...

  8. 使用Docker搭建Jenkins+Docker持续集成环境(自动化构建发布部署)

    本文介绍如何通过Jenkins的docker镜像从零开始构建一个基于docker镜像的持续集成环境,包含自动化构建.发布到仓库\并部署上线. 0. 前置条件 服务器安装docker,并启动docker ...

  9. Docker+Jenkins持续集成环境(5): android构建与apk发布

    项目组除了常规的java项目,还有不少android项目,如何使用jenkins来实现自动构建呢?本文会介绍安卓项目通过jenkins构建的方法,并设计开发一个类似蒲公英的app托管平台. andro ...

随机推荐

  1. 初学Python——介绍一些内置方法

    1.abs()求绝对值 a=abs(-10) print(a) # 输出:10 2.all() 用来检测列表元素是否全部为空.0.False print(all([0,5,4])) #当列表所有元素都 ...

  2. Java 数据类型总结

    Java 中提供了八种数据类型:6个数字类型(四个整数型,两个浮点型).字符类型.布尔型. 依次分别是 : byte.int.short.long.float.double.char.boolean. ...

  3. Mac支持ntfs格式的移动硬盘读写操作

    转好文:https://blog.csdn.net/u013247765/article/details/77932144 本机环境: macOS Sierra version 10.12.6 201 ...

  4. 在开发框架中使用FTP辅助类上传或者下载文件,方便管理附件内容

    在有些系统应用里面,我们需要对应用服务器.数据库服务器.文件服务器进行分开,文件路径等信息存储在数据库服务器里面,但文件内容则存储在文件服务器里面,通过使用FTP进行文件的上传下载,从而实现更加高效的 ...

  5. 自建 Gitlab (邮箱配置、拆分 PostgreSQL、Redis) + 随想

    前言 最近折腾了一番自建 gitlab,在此做个记录,供君参考.整个构建过程基于 Docker Swarm(近期有计划将微服务移植到 Kubernetes,但还没倒腾顺手,暂时先沿用旧的方案),主题配 ...

  6. 阿里云作为yum源操作

    阿里云提供的yum镜像地址为:https://opsx.alibaba.com/mirror 找到自己的使用系统,点击帮助,可以查看更换说明 替换centOS的yum源,如下图 具体操作: CentO ...

  7. HTTP请求中的Keep-Alive模式,是怎么区分多个请求的?

    Keep-Alive模式 我们都知道HTTP是基于TCP的,每一个HTTP请求都需要进行三步握手.如果一个页面对某一个域名有多个请求,就会进行频繁的建立连接和断开连接.所以HTTP 1.0中出现了Co ...

  8. java问题

    Collection 和 Collections的区别? Collection是集合类的上级接口,继承与他的接口主要有Set 和List. Collections是针对集合类的一个帮助类,他提供一系列 ...

  9. iOS-带图片的二维码的生成(QRCode)

    https://blog.csdn.net/feng512275/article/details/82824650 2018年09月23日 20:29:45 筝风放风筝 阅读数:91   版权声明:本 ...

  10. [iOS]一行代码集成空白页面占位图(基于runtime+MJRefresh思想)

    2018年01月03日阅读 2472   [iOS]一行代码集成空白页面占位图(基于runtime+MJRefresh思想) LYEmptyView 此框架是本人在5,6个月前,公司启动新项目的时候, ...