0
0
Jenkinsdevops~10 mins

Triggers directive in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to trigger a Jenkins job every 15 minutes.

Jenkins
pipeline {
  triggers {
    cron('[1]')
  }
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
AH/15 * * * *
B15 * * * *
C*/15 * * * *
D0 15 * * *
Attempts:
3 left
💡 Hint
Common Mistakes
Using '15 * * * *' triggers only at minute 15 every hour.
2fill in blank
medium

Complete the code to trigger a Jenkins job on GitHub push events.

Jenkins
pipeline {
  triggers {
    [1]()
  }
  stages {
    stage('Test') {
      steps {
        echo 'Testing...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
ApollSCM
BgithubPush
Cscm
DpipelineTriggers
Attempts:
3 left
💡 Hint
Common Mistakes
Using pollSCM instead of githubPush.
3fill in blank
hard

Fix the error in the triggers block to poll SCM every 10 minutes.

Jenkins
pipeline {
  triggers {
    pollSCM('[1]')
  }
  stages {
    stage('Deploy') {
      steps {
        echo 'Deploying...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
AH/10 * * * *
B*/5 * * * *
C10 * * * *
D0 10 * * *
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*/10 * * * *' can cause all jobs to poll simultaneously.
4fill in blank
hard

Fill both blanks to trigger a Jenkins job every day at midnight and on SCM changes.

Jenkins
pipeline {
  triggers {
    cron('[1]')
    [2]('H/5 * * * *')
  }
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A0 0 * * *
BpollSCM
CgithubPush
Dcron
Attempts:
3 left
💡 Hint
Common Mistakes
Using githubPush instead of pollSCM for SCM polling.
5fill in blank
hard

Fill all three blanks to trigger a Jenkins job every hour, on GitHub push, and every Sunday at 2 AM.

Jenkins
pipeline {
  triggers {
    cron('[1]')
    [2]()
    cron('[3]')
  }
  stages {
    stage('Test') {
      steps {
        echo 'Testing...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A0 * * * *
BpollSCM
C0 2 * * 0
DgithubPush
Attempts:
3 left
💡 Hint
Common Mistakes
Using pollSCM instead of githubPush for GitHub push.