Overview - Options directive (timeout, retry)
What is it?
The Options directive in Jenkins Pipeline allows you to set special behaviors for your pipeline or stages, such as limiting how long a step can run or how many times it should retry on failure. Two common options are timeout, which stops a step if it runs too long, and retry, which repeats a step if it fails. These options help make your automation more reliable and efficient by handling delays and errors automatically.
Why it matters
Without timeout and retry options, pipelines can hang forever or fail without trying again, causing delays and wasted resources. These options prevent stuck builds and improve success rates by managing time limits and automatic retries. This means faster feedback and more stable automation, which is crucial for teams relying on continuous integration and delivery.
Where it fits
Before learning Options directive, you should understand basic Jenkins Pipelines and how to write stages and steps. After mastering options like timeout and retry, you can explore advanced error handling, parallel execution, and custom pipeline libraries to build robust automation workflows.