我想创建一个每分钟运行一次的自由式作业。我可以让它与“触发器”一起使用,不确定是什么问题
job('myjob') {
// doesnt throw error and doesnt configure trigger
//triggers { cron "* * * *" }
// throws error when running
//triggers { periodic(1) }
// this works but I want 1 minute not 2 minutes
// the correct syntax in the UI is just "* * * *" but dsl doesnt seem to like that
//triggers { cron "H/2 * * * *" }
steps {
systemGroovyCommand("""
jenkins.model.Jenkins.instance.getAllItems(jenkins.model.ParameterizedJobMixIn.ParameterizedJob.class).findAll{
println it
}
""")
}
答案 0 :(得分:0)
Cron条目必须包含五个元素。正确的语法是
triggers { cron("* * * * *") }
答案 1 :(得分:0)
似乎您错过了一个元素,如果要输入cron,则必须为5个元素。
triggers {
cron('* * * * *')
}