Complete the code to trigger a Jenkins job every 15 minutes.
pipeline {
triggers {
cron('[1]')
}
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}The cron expression */15 * * * * triggers the job every 15 minutes.
Complete the code to trigger a Jenkins job on GitHub push events.
pipeline {
triggers {
[1]()
}
stages {
stage('Test') {
steps {
echo 'Testing...'
}
}
}
}pollSCM instead of githubPush.The githubPush() trigger responds to GitHub push events.
Fix the error in the triggers block to poll SCM every 10 minutes.
pipeline {
triggers {
pollSCM('[1]')
}
stages {
stage('Deploy') {
steps {
echo 'Deploying...'
}
}
}
}The expression H/10 * * * * polls SCM every 10 minutes with a hashed start time.
Fill both blanks to trigger a Jenkins job every day at midnight and on SCM changes.
pipeline {
triggers {
cron('[1]')
[2]('H/5 * * * *')
}
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}githubPush instead of pollSCM for SCM polling.The cron('0 0 * * *') triggers daily at midnight, and pollSCM('H/5 * * * *') polls SCM every 5 minutes.
Fill all three blanks to trigger a Jenkins job every hour, on GitHub push, and every Sunday at 2 AM.
pipeline {
triggers {
cron('[1]')
[2]()
cron('[3]')
}
stages {
stage('Test') {
steps {
echo 'Testing...'
}
}
}
}pollSCM instead of githubPush for GitHub push.The first cron('0 * * * *') triggers hourly, githubPush() responds to GitHub push events, and the second cron('0 2 * * 0') triggers every Sunday at 2 AM.