content_image/738536.jpg
## triggers 

The triggers  directive defines the automated ways in which the Pipeline should be re-triggered. For Pipelines which are integrated with a source such as GitHub or BitBucket, triggers  may not be necessary as webhooks-based integration will likely already be present. The triggers currently available are cron , pollSCM  and upstream . 

<img src='content_image/738536.jpg'>

## cron 

Accepts a cron-style string to define a regular interval at which the Pipeline should be re- triggered, for example: triggers { cron('H */4 * * 1-5') } 

## pollSCM 

Accepts a cron-style string to define a regular interval at which Jenkins should check for new source changes. If new changes exist, the Pipeline will be re-triggered. For example: triggers { pollSCM('H */4 * * 1-5') } 

## upstream 

Accepts a comma separated string of jobs and a threshold. When any job in the string finishes with the minimum threshold, the Pipeline will be re-triggered. For example: triggers { upstream(upstreamProjects: 'job1,job2', threshold: hudson.model.Result.SUCCESS) } 

## NOTE 

## Example 

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

The pollSCM  trigger is only available in Jenkins 2.22 or later. 

