在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语法执行此操作?
使用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