Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Jenkins has a built-in timeout feature that can be used to mark a build as failed if it takes too long to complete. Here are the steps to set a timeout and mark the build as failed once the timeout is reached:

  1. Open the Jenkins job configuration page.
  2. Scroll down to the "Build" section and click on "Add build step" or "Add post-build action" depending on where you want to set the timeout.
  3. Select "Execute shell" or "Execute Windows batch command" depending on your environment.
  4. Enter the command you want to run and add the following line at the end:
timeout 60 || exit 1

This will cause the build to fail if it takes more than 60 seconds to complete.

  1. Save the job configuration and run a build.

Now, if the build takes longer than 60 seconds, it will be marked as failed and the status will change to "FAILED".