从脚本化的Jenkinsfile触发每小时构建

Ale*_*lex 16 cron-task jenkins jenkins-pipeline

有没有办法使用Jenkinsfile 脚本管道语法触发Jenkins作业每小时运行一次?

我见过使用声明性语法的示例,但没有使用管道语法.

声明性语法示例

pipeline {
    agent any

    triggers {
        cron '@daily'
    }

   ...
}
Run Code Online (Sandbox Code Playgroud)

Vad*_*tov 21

您可以将此代码段用于Scripted pipeline syntax:

properties(
    [
        ...  , // other properties that you have
        pipelineTriggers([cron('0 * * * *')]),
    ]
)
Run Code Online (Sandbox Code Playgroud)

更多信息在这里.这里
介绍了涵盖声明性管道的文档.

  • 它在jenkins 2.79下的脚本管道中不起作用(java.lang.UnsupportedOperationException:未定义的符号'pipelineTriggers') (3认同)