首页 > 解决方案 > Jenkins如何将cron字符串作为参数传递

问题描述

是否可以将参数作为字符串传递,如下所示?

properties([
cronStr = "/3 * * * *"
pipelineTriggers([cron(cronStr)]),
])

标签: jenkinsgroovy

解决方案


谢谢@KB,以下对我有用。变量范围的问题。

def cronStr = "/3 * * * *" 
properties([ 
pipelineTriggers([cron(cronStr)]), 
]) 

推荐阅读