jenkinsci / build-timeout-plugin

Jenkins build-timeout plugin
https://plugins.jenkins.io/build-timeout/
31 stars 80 forks source link

= Build Timeout Plugin

This plugin allows you to automatically terminate a build if it's taking too long.

This plugin isn't applicable to pipelines.

Use the https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#timeout-enforce-time-limit[`+timeout+` step in workflow-basic-steps] instead.

== Instructions for the user

=== Global configuration

Go to Manage Jenkins and then Configure System. Under the item Global Build Time Out you can activate a global timeout which will be applied to any job. Choose your timeout strategy, the duration and add actions which should be executed at timeout.

In addition, the option can be activated that individual jobs can overwrite the global timeout if they provide a corresponding build step.

image::doc/global-config.png[]

Note that sometimes if a project is not of the hudson.model.Project type, then the individual jobs would not be allowed to overwrite the global timeout.

=== Build environment

Alternatively, the timeout can be specified in the build environment of a job. To do this, click Configure in the job view and in the build environment section, select the item Terminate a build if it's stuck.

image::doc/build-environment.png[]

Because Java only allows threads to be interrupted at a set of fixed locations, depending on how a build hangs, the abort operation might not take effect. For example,

So if you think the build timeout isn't taking effect, our default assumption is that the build is hanging at the place that cannot be interrupted. If you suspect otherwise, please https://wiki.jenkins-ci.org/display/JENKINS/Build+is+hanging[obtain the thread dump] and report it.

=== Build step

Add a new step Run with timeout at the section Build, add the timeout strategy and duration, add some actions and the build step you want to execute within the timout step.

image::doc/build-step.png[]

== For developers

If you are interested in contributing, please pay attention to the below steps:

=== To test

[source,shell]

mvn verify

=== To build [source,shell]

mvn hpi:run

For newcomers, please see guide at https://www.jenkins.io/participate/[] for more information about how to participate and contribute.

== Time-out actions with notes

[cols=",",options="header",] |=== |Time-out action |Note |Abort and restart the build |Installing https://plugins.jenkins.io/naginator[Naginator Plugin] enables this action |===

include::CHANGELOG.adoc[]