Recall & Review
beginner
What is the purpose of the
triggers directive in a Jenkins pipeline?The
triggers directive is used to automatically start a Jenkins pipeline based on specific events or schedules, like a timer or a source code change.Click to reveal answer
beginner
How do you schedule a Jenkins pipeline to run every day at midnight using the
triggers directive?Use the
cron trigger inside triggers with the schedule 0 0 * * * to run the pipeline daily at midnight.Click to reveal answer
intermediate
What is the syntax to trigger a Jenkins pipeline when a GitHub push event occurs?
Use the
pollSCM trigger or configure a webhook in GitHub. In declarative pipeline, pollSCM can be set inside triggers to check for changes.Click to reveal answer
intermediate
Can you use multiple triggers inside the
triggers directive? Give an example.Yes, you can combine triggers like
cron and pollSCM inside triggers to run pipelines on schedule and on source changes.Click to reveal answer
beginner
What happens if you omit the
triggers directive in a Jenkins pipeline?The pipeline will not start automatically. It must be started manually or triggered by other means outside the pipeline script.
Click to reveal answer
Which Jenkins pipeline directive is used to automatically start a job on a schedule?
✗ Incorrect
The
triggers directive defines automatic start conditions like schedules.What cron expression runs a Jenkins pipeline every hour?
✗ Incorrect
The expression
0 * * * * runs the job at minute 0 of every hour.Which trigger checks for source code changes in Jenkins?
✗ Incorrect
The
pollSCM trigger polls the source control for changes.Can you combine multiple triggers inside the
triggers directive?✗ Incorrect
Multiple triggers like
cron and pollSCM can be used together.What happens if no
triggers directive is defined in a Jenkins pipeline?✗ Incorrect
Without triggers, the pipeline must be started manually or by other external means.
Explain how the
triggers directive works in Jenkins pipelines and give an example of a scheduled trigger.Think about how to run a job every day without clicking start.
You got /3 concepts.
Describe how you can trigger a Jenkins pipeline when code changes happen in a Git repository.
Consider how Jenkins knows when new code is pushed.
You got /3 concepts.