• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • build-timeout-plugin
    • None

      With many jobs, it is a pain to set timeout on each job. Having a global setting (than can be overrided in job configuration) can be more simple.

          [JENKINS-26778] Build-timeout+Plugin global timeout setting

          Bassam Khouri added a comment -

          I like this idea. I recently have to recover a jenkins server and forgot to install the "build timeout plugin" before importing all the job configs, so it got lost.

          It would be ideal to have the ability to either:

          • have a global timeout config, which each job can override
          • functionality to bulk modify jobs to add the build timeout (I'm unable to do this via the Configuration Slicing Plugin)

          Bassam Khouri added a comment - I like this idea. I recently have to recover a jenkins server and forgot to install the "build timeout plugin" before importing all the job configs, so it got lost. It would be ideal to have the ability to either: have a global timeout config, which each job can override functionality to bulk modify jobs to add the build timeout (I'm unable to do this via the Configuration Slicing Plugin )

          ikedam added a comment -

          You can use variables for configurations since build-timeout 1.14.
          That allows you the global configuration (using global variables) and overriding in each projects (using hidden parameter) and in each builds (using build parameters).

          ikedam added a comment - You can use variables for configurations since build-timeout 1.14. That allows you the global configuration (using global variables) and overriding in each projects (using hidden parameter ) and in each builds (using build parameters).

          Hi , I recently installed build timeout plugin 1.14 and looking to populate it for all jobs . Can you please explain how the global variable setting can be done and if it will help even if the timeout was not set earlier for a job . I checked out a couple of groovy scripts also to do the same but the constructor used there was depreciated . I am a newbie for groovy usage for modifying configs . Please help me out here.

          Thanks

          Vaibhav Dwivedi added a comment - Hi , I recently installed build timeout plugin 1.14 and looking to populate it for all jobs . Can you please explain how the global variable setting can be done and if it will help even if the timeout was not set earlier for a job . I checked out a couple of groovy scripts also to do the same but the constructor used there was depreciated . I am a newbie for groovy usage for modifying configs . Please help me out here. Thanks

          ikedam added a comment -

          coolvaiv28 You need nothing special nor groovy scripts:

          1. Define a global variable:
            1. Go to "Manage Jenkins" > "Configure System"
            2. Check "Environment variables" in "Global properties"
            3. Add an environment variable like name="GLOBAL_TIMEOUT_MINS" value="60" (60 mins)
          2. Use that in build-timeout
            1. Go to a configuration page of a project.
            2. Check "Abort the build if it's stack" in "Build Environment"
            3. Select "Absolute" for "Time-out strategy"
              • Of course, also applicable to other strategies.
            4. Set "${GLOBAL_TIMEOUT_MINS}" for "Timeout minutes"

          ikedam added a comment - coolvaiv28 You need nothing special nor groovy scripts: Define a global variable: Go to "Manage Jenkins" > "Configure System" Check "Environment variables" in "Global properties" Add an environment variable like name="GLOBAL_TIMEOUT_MINS" value="60" (60 mins) Use that in build-timeout Go to a configuration page of a project. Check "Abort the build if it's stack" in "Build Environment" Select "Absolute" for "Time-out strategy" Of course, also applicable to other strategies. Set "${GLOBAL_TIMEOUT_MINS}" for "Timeout minutes"

          Hi Ikedam ,

          Thanks for the detailed steps but I was hoping to avoid going to each and every project configuration and do changes manually .
          So as of now I wrote a shell snippet to append config.xml for all such projects which is a bit gross but does the work.
          Btw are you aware of any groovy tutorials meant specifically for jenkins configuration changes.

          Vaibhav Dwivedi added a comment - Hi Ikedam , Thanks for the detailed steps but I was hoping to avoid going to each and every project configuration and do changes manually . So as of now I wrote a shell snippet to append config.xml for all such projects which is a bit gross but does the work. Btw are you aware of any groovy tutorials meant specifically for jenkins configuration changes.

          ikedam added a comment -

          I don't know about changing configurations automatically.

          ikedam added a comment - I don't know about changing configurations automatically.

          Jarkko Rantavuori added a comment - Using Groovy, Idea and old version here: https://janmaterne.wordpress.com/2010/07/11/how-to-check-if-all-hudson-jobs-have-a-timeout/ Updated version using current interfaces: https://gist.github.com/seanf/8c0933694a9383152bc2

          Is thi still planned. We have hundreds of pipeline jobs created automatically by the Github webhooks based on Jenkinsfile presence. Jenkinfiles wrote by people who doesn't really care about timeouts, so they never put such constraint int their jobs. So I desperatly need something like global timeout, otherwsise we see lots of long running jobs where we need manually cancel them.

          Alex Simenduev added a comment - Is thi still planned. We have hundreds of pipeline jobs created automatically by the Github webhooks based on Jenkinsfile presence. Jenkinfiles wrote by people who doesn't really care about timeouts, so they never put such constraint int their jobs. So I desperatly need something like global timeout, otherwsise we see lots of long running jobs where we need manually cancel them.

          Felipe Santos added a comment -

          This would be very much appreciated! As commented earlier, it would help by reducing the manual task of cleaning up stuck jobs.

          Felipe Santos added a comment - This would be very much appreciated! As commented earlier, it would help by reducing the manual task of cleaning up stuck jobs.

            kohsuke Kohsuke Kawaguchi
            kenji Richard Bergoin
            Votes:
            14 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated: