Bird
Raised Fist0
Jenkinsdevops~20 mins

Build triggers (poll SCM, webhook, timer) in Jenkins - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Build Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this Jenkinsfile snippet with a poll SCM trigger?

Given this Jenkinsfile snippet, what will Jenkins do?

pipeline {
  triggers {
    pollSCM('H/15 * * * *')
  }
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
}
AJenkins polls the source code repository every 15 minutes and triggers a build if changes are detected.
BJenkins triggers a build every 15 minutes regardless of source code changes.
CJenkins triggers a build only once when the pipeline is first created.
DJenkins triggers a build every 15 seconds regardless of source code changes.
Attempts:
2 left
💡 Hint

Poll SCM means Jenkins checks the source code for changes on a schedule.

🧠 Conceptual
intermediate
1:30remaining
Which build trigger uses a webhook to start a Jenkins build?

Choose the build trigger type that starts a Jenkins build immediately when a source code change is pushed.

ATimer trigger
BWebhook trigger
CPoll SCM trigger
DManual trigger
Attempts:
2 left
💡 Hint

Think about which trigger reacts instantly to external events.

❓ Configuration
advanced
2:00remaining
Identify the correct cron syntax for a Jenkins timer trigger to run daily at 2:30 AM

Which of the following cron expressions correctly schedules a Jenkins timer trigger to run every day at 2:30 AM?

A2 30 * * *
B30 02 * * 1-5
C30 2 * * *
D0 2 30 * *
Attempts:
2 left
💡 Hint

Cron format is: minute hour day-of-month month day-of-week

❓ Troubleshoot
advanced
2:30remaining
Why does a Jenkins job with poll SCM trigger never start a build?

A Jenkins job has a poll SCM trigger set to check every 10 minutes, but no builds start even after code changes. What is the most likely reason?

AThe Jenkins server cannot access the source code repository to detect changes.
BThe poll SCM trigger syntax is incorrect and causes a syntax error.
CThe timer trigger is overriding the poll SCM trigger.
DThe webhook is disabled, so builds cannot start.
Attempts:
2 left
💡 Hint

Think about network or permission issues that prevent Jenkins from checking the repository.

✅ Best Practice
expert
3:00remaining
Which build trigger strategy is best for minimizing unnecessary builds in a busy team?

Your team pushes code frequently. You want to minimize unnecessary Jenkins builds while ensuring fast feedback on changes. Which trigger strategy is best?

AUse manual triggers only to control builds.
BUse poll SCM every minute to catch changes quickly.
CUse a timer trigger to build every hour regardless of changes.
DUse webhook triggers to start builds immediately on push events.
Attempts:
2 left
💡 Hint

Consider which trigger reacts instantly but only when needed.

Practice

(1/5)
1. Which Jenkins build trigger checks the source code repository regularly for changes before starting a build?
easy
A. poll SCM
B. webhook
C. timer (cron)
D. manual trigger

Solution

  1. Step 1: Understand the purpose of poll SCM

    poll SCM trigger makes Jenkins check the source code repository at set intervals for any changes.
  2. Step 2: Compare with other triggers

    Webhook triggers build instantly on code push, timer triggers build at scheduled times, manual trigger requires user action.
  3. Final Answer:

    poll SCM -> Option A
  4. Quick Check:

    poll SCM = checks repo regularly [OK]
Hint: poll SCM means Jenkins checks repo regularly [OK]
Common Mistakes:
  • Confusing webhook with poll SCM
  • Thinking timer triggers check repo changes
  • Assuming manual trigger is automatic
2. Which of the following is the correct syntax to schedule a Jenkins build every day at midnight using cron?
easy
A. * * * * 0
B. 0 0 * * *
C. 0 12 * * *
D. 0 0 0 * *

Solution

  1. Step 1: Understand cron syntax

    Cron format is 'minute hour day month weekday'. To run at midnight daily, minute=0 and hour=0.
  2. Step 2: Match the correct expression

    0 0 * * * "0 0 * * *" means every day at 00:00 hours (midnight).
  3. Final Answer:

    0 0 * * * -> Option B
  4. Quick Check:

    Midnight daily cron = 0 0 * * * [OK]
Hint: Midnight daily cron is always '0 0 * * *' [OK]
Common Mistakes:
  • Mixing hour and minute fields
  • Using wrong day or weekday values
  • Confusing 12 PM with midnight
3. Given this Jenkins pipeline snippet, what will trigger the build?
triggers {
  pollSCM('H/15 * * * *')
}
medium
A. Build runs only if SCM changes detected every 15 minutes
B. Build runs every 15 minutes regardless of changes
C. Build runs once daily at 15 minutes past midnight
D. Build runs immediately after a webhook event

Solution

  1. Step 1: Understand pollSCM with 'H/15 * * * *'

    This means Jenkins checks the SCM every 15 minutes for changes.
  2. Step 2: Determine when build triggers

    Build triggers only if changes are detected during these checks, not every 15 minutes automatically.
  3. Final Answer:

    Build runs only if SCM changes detected every 15 minutes -> Option A
  4. Quick Check:

    pollSCM triggers on changes every 15 mins [OK]
Hint: pollSCM triggers only on changes, not just time [OK]
Common Mistakes:
  • Assuming build runs every 15 minutes regardless
  • Confusing pollSCM with timer trigger
  • Thinking webhook triggers are involved here
4. A Jenkins job with this trigger configuration does not start builds as expected:
triggers {
  pollSCM('H/5 * * * *')
}
What is the most likely cause?
medium
A. Timer trigger conflicts with pollSCM
B. The cron syntax 'H/5 * * * *' is invalid
C. Webhook is required for pollSCM to work
D. SCM polling is disabled in Jenkins global settings

Solution

  1. Step 1: Check pollSCM prerequisites

    pollSCM requires SCM polling enabled globally in Jenkins settings.
  2. Step 2: Validate other options

    Syntax 'H/5 * * * *' is valid; webhook is separate trigger; no conflict with timer here.
  3. Final Answer:

    SCM polling is disabled in Jenkins global settings -> Option D
  4. Quick Check:

    pollSCM needs global SCM polling enabled [OK]
Hint: pollSCM needs global SCM polling enabled [OK]
Common Mistakes:
  • Assuming cron syntax is wrong
  • Thinking webhook is mandatory for pollSCM
  • Believing timer conflicts cause failure
5. You want Jenkins to build your project automatically every weekday at 6 AM and also immediately when code is pushed to GitHub. Which trigger setup is best?
hard
A. Use only pollSCM with cron '0 6 * * 1-5'
B. Use webhook only without timer
C. Use timer trigger '0 6 * * 1-5' and configure GitHub webhook
D. Use pollSCM every minute

Solution

  1. Step 1: Understand requirements

    Build at 6 AM weekdays and immediately on GitHub push means two triggers needed: timer and webhook.
  2. Step 2: Evaluate options

    Use timer trigger '0 6 * * 1-5' and configure GitHub webhook combines timer for scheduled build and webhook for instant build on push, fulfilling both needs.
  3. Final Answer:

    Use timer trigger '0 6 * * 1-5' and configure GitHub webhook -> Option C
  4. Quick Check:

    Timer + webhook = scheduled + instant builds [OK]
Hint: Combine timer and webhook for schedule plus instant build [OK]
Common Mistakes:
  • Using only pollSCM misses instant build
  • Using webhook alone misses scheduled build
  • Polling every minute is inefficient
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard