Jenkins Build Pipeline Scheduled Trigger Jenkins Build Pipeline Scheduled Trigger jenkins jenkins

Jenkins Build Pipeline Scheduled Trigger


Declarative pipeline has triggers directive, one uses it like this:

triggers { cron('H 4/* 0 0 1-5') }

I took it from Pipeline Syntax docs


You can set the job parameters using the following syntax:

properties([pipelineTriggers([cron('H 23 * * *')])])

Adding this line to your build script or Jenkinsfile will configure the job to run every night at 11PM.


Complete Example (taken from docs)Ref: https://jenkins.io/doc/book/pipeline/syntax/#triggers

pipeline {    agent any    triggers {        cron('H */4 * * 1-5')    }    stages {        stage('Example') {            steps {                echo 'Hello World'            }        }    }}