使用job-dsl / pipeline语法的多个cron表达式

问题描述 投票:2回答:1

在Jenkins作业配置的构建触发器部分中,可以在Schedule textarea中的每一行上添加多个cron表达式,例如:

13 20 * * 0,1,2,3,4,5,6
13 8 * * 0,1,2,3,4,5,6

https://stackoverflow.com/a/44209349/1291886

如何使用job-dsl / pipeline语法执行此操作?

jenkins cron jenkins-pipeline jenkins-job-dsl
1个回答
5
投票

使用job-dsl语法:

triggers {
    cron('13 20 * * 0,1,2,3,4,5,6 \n 13 8 * * 0,1,2,3,4,5,6')
}

从job-dsl文档:

要配置多行条目,请使用单个触发器字符串,其条目以\ n分隔。

https://jenkinsci.github.io/job-dsl-plugin/#path/freeStyleJob-triggers-cron

© www.soinside.com 2019 - 2024. All rights reserved.