詹金斯工作 dsl 触发器不适用于自由式工作
jenkins job dsl trigger not working for freestyle job
我想创建一个每分钟运行一次的自由式作业。我可以让它与“触发器”一起工作,但不确定是什么问题
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
}
""")
}
Cron 条目必须包含 五个 元素。正确的语法是
triggers { cron("* * * * *") }
好像少了一个元素,如果是cron entry的话需要5个元素
triggers {
cron('* * * * *')
}
我想创建一个每分钟运行一次的自由式作业。我可以让它与“触发器”一起工作,但不确定是什么问题
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
}
""")
}
Cron 条目必须包含 五个 元素。正确的语法是
triggers { cron("* * * * *") }
好像少了一个元素,如果是cron entry的话需要5个元素
triggers {
cron('* * * * *')
}