Build timeouts
📖 Scenario: You are managing a Jenkins pipeline that runs automated tests. Sometimes, tests hang and cause the build to run forever. To avoid wasting resources, you want to set a timeout for the build.
🎯 Goal: You will create a Jenkins pipeline script that sets a build timeout of 10 minutes. If the build runs longer, it will be aborted automatically.
📋 What You'll Learn
Create a Jenkins pipeline script with a
timeout blockSet the timeout duration to 10 minutes
Inside the timeout block, add a simple
echo stepPrint a message after the timeout block to confirm the build continues if not timed out
💡 Why This Matters
🌍 Real World
Build timeouts prevent Jenkins builds from running forever, saving resources and avoiding stuck pipelines.
💼 Career
Knowing how to set build timeouts is essential for DevOps engineers to maintain stable and efficient CI/CD pipelines.
Progress0 / 4 steps