【发布时间】:2020-07-10 22:46:12
【问题描述】:
我在我的 Jenkins 脚本中使用参数化的 cron 来运行 2 组不同的构建参数 - 一个在生产中每 5 分钟运行一次,在暂存中每 15 分钟运行一次。生产版每 5 分钟运行一次,但暂存版未运行。有人可以告诉我我可能缺少什么吗?
properties([
pipelineTriggers([parameterizedCron(env.BRANCH_NAME != 'master' ? '''
H/5 * * * * % environment=production
H/15 * * * * % environment=staging''' : '')]),
parameters([
choice(name: 'environment', defaultValue: 'sandbox', choices: ['sandbox', 'staging', 'production'], description: "etc")
])
])
A 做了如下的轻微修改,令人惊讶的是这次只有登台运行
properties([
pipelineTriggers([parameterizedCron('''H/2 * * * * % environment=production'''), parameterizedCron('''H/4 * * * * % environment=staging''')]),
parameters([
choice(name: 'environment', defaultValue: 'sandbox', choices: ['sandbox', 'staging', 'production'], description: "etc")
])
])
我找不到任何一个只能半途而废的原因。
谁能告诉我可以改变什么来解决这个问题?
【问题讨论】:
标签: jenkins triggers cron jenkins-pipeline parameterized