0
0
Jenkinsdevops~5 mins

Options directive (timeout, retry) in Jenkins - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the timeout option do in a Jenkins pipeline?
The timeout option stops the pipeline if it runs longer than the specified time. This helps avoid stuck or slow builds.
Click to reveal answer
beginner
How does the retry option help in Jenkins pipelines?
The retry option tries to run a block of steps again if they fail, up to a set number of times. It helps handle temporary errors.
Click to reveal answer
intermediate
Show a simple Jenkins pipeline snippet using timeout and retry options.
pipeline { options { timeout(time: 10, unit: 'MINUTES') } stages { stage('Build') { steps { retry(3) { echo 'Building...' } } } } }
Click to reveal answer
beginner
What happens if a Jenkins pipeline step exceeds the timeout duration?
Jenkins stops the pipeline and marks it as failed. This prevents wasting resources on stuck or very slow builds.
Click to reveal answer
intermediate
Can the retry option be used inside a specific stage or only globally in Jenkins pipelines?
The retry option can be used inside specific stages or steps to retry only that part, or globally to retry the whole pipeline block.
Click to reveal answer
What does the Jenkins timeout option control?
ANumber of times to retry a failed step
BMaximum time a pipeline or stage can run before stopping
CThe delay between pipeline runs
DThe number of parallel builds allowed
How many times will Jenkins retry a step if retry(3) is set and the step keeps failing?
A4 times
B2 times
C1 time
D3 times
Where can the timeout option be placed in a Jenkins pipeline?
AOnly inside stages
BOnly inside steps
CInside the options block at pipeline or stage level
DOnly in the Jenkins global configuration
What happens if a step fails but no retry option is set?
AThe pipeline fails immediately
BThe pipeline pauses for manual input
CJenkins retries automatically once
DThe pipeline ignores the failure
Which unit can be used with the Jenkins timeout option?
AAll of the above
BMINUTES
CHOURS
DSECONDS
Explain how the timeout and retry options improve Jenkins pipeline reliability.
Think about how these options prevent failures and delays.
You got /4 concepts.
    Describe where and how to use the timeout and retry options in a Jenkins pipeline script.
    Consider the syntax and placement in the Jenkinsfile.
    You got /4 concepts.