Jenkins Jenkins Build Triggers and Scheduling 1 — Questions and Answers
Question 1: Which Jenkins trigger automatically starts a build when a source code change is detected in the SCM repository?
- Poll SCM (Correct answer)
- Build periodically
- GitHub hook trigger for GITScm polling
- Trigger builds remotely
Correct answer: Poll SCM
Poll SCM periodically checks the SCM repository for changes and triggers a build only when changes are detected.
Question 2: What cron syntax would you use in Jenkins to run a build every day at midnight?
- 0 0 * * * (Correct answer)
- * * * * 0
- 0 * * * *
- * 0 * * *
Correct answer: 0 0 * * *
In Jenkins cron syntax, '0 0 * * *' means minute 0, hour 0 (midnight), every day of the month, every month, every day of the week.
Question 3: Which Jenkins trigger is used to start a build via an HTTP request to a specific URL using a token?
- Trigger builds remotely (Correct answer)
- Poll SCM
- GitHub webhook
- Upstream project trigger
Correct answer: Trigger builds remotely
Trigger builds remotely allows external systems to start a Jenkins build by calling a URL with an authentication token.
Question 4: In Jenkins, what does the 'Build after other projects are built' trigger do?
- Starts a build when specified upstream projects complete (Correct answer)
- Polls upstream projects for changes
- Rebuilds failed upstream jobs
- Chains jobs in a pipeline
Correct answer: Starts a build when specified upstream projects complete
This trigger creates a dependency relationship so the current job runs automatically after specified upstream jobs finish building.
Question 5: What is the purpose of the 'H' symbol in Jenkins cron scheduling expressions?
- Hashed scheduling to spread load across time (Correct answer)
- Hourly scheduling
- Half-period scheduling
- High-priority scheduling
Correct answer: Hashed scheduling to spread load across time
The 'H' symbol uses a hash of the job name to select a consistent but distributed time, preventing many jobs from triggering simultaneously.
Question 6: Which of the following correctly configures Jenkins to build a project every 15 minutes?
- H/15 * * * * (Correct answer)
- */15 * * * *
- 15 * * * *
- 0,15,30,45 * * * *
Correct answer: H/15 * * * *
Using 'H/15' is preferred over '*/15' because it distributes job start times across the interval to balance server load.
Question 7: When using webhook-based triggers in Jenkins, what advantage do they have over Poll SCM?
- They notify Jenkins immediately when a change occurs, reducing latency (Correct answer)
- They require less network bandwidth
- They are more secure
- They work without network access to the SCM server
Correct answer: They notify Jenkins immediately when a change occurs, reducing latency
Webhooks push notifications to Jenkins the moment a commit happens, so builds start immediately rather than waiting for the next polling interval.
Which Jenkins trigger automatically starts a build when a source code change is detected in the SCM repository?