Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42561

Users should be able to custom configure the timeout on pipeline build wrappers/steps

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      As part of JENKINS-32986 pipeline cps plugin has introduced a 5 min timeout for each instruction on the script.
      Custom scripts that are implemented as jenkins.tasks.BuildWrapper are now subject to this limitation.
      As BuildWrappers are a very useful and common extension point it seems to me that Jenkins administrators should be able to increase this hard coded timeout by passing a configuration (maybe a -D vm param)
      OR (even better) developers that are writing Build wrappers can provide something like a max timeout hint to cps treat it properly (maybe by implementing an interface or an annotation).

      This change on behavior from 2.4 to 2.5 pipeline jenkins broke our plugin on some use cases.

      As DurableSteps (that are not subject to this limitation) are "steps" not "wrappers" I cannot see how to change our implementation to some structure that acts as a wrapper without touch the 5 min limitation.

      Relevant commit
      https://github.com/jenkinsci/workflow-cps-plugin/commit/c0deed0a3b546ebcb59ea25681ed3ac8b13fe6bb

          [JENKINS-42561] Users should be able to custom configure the timeout on pipeline build wrappers/steps

          Lucas Machado added a comment -

          This PR https://github.com/jenkinsci/workflow-cps-plugin/pull/115 can add this parameter to the server level.

          Lucas Machado added a comment - This PR https://github.com/jenkinsci/workflow-cps-plugin/pull/115 can add this parameter to the server level.

          Jesse Glick added a comment -

          Increasing the timeout is a bad fix. Really your plugin must stop blocking the CPS VM thread. Pending JENKINS-43276, if setUp can be expected to take more than a second or so, then you must not implement SimpleBuildWrapper.

          Jesse Glick added a comment - Increasing the timeout is a bad fix. Really your plugin must stop blocking the CPS VM thread. Pending  JENKINS-43276 , if setUp can be expected to take more than a second or so, then you must not implement  SimpleBuildWrapper .

          Lucas Machado added a comment -

          We are working on the fix.
          Our current limitation is actually the Tail call of a build wrapper.
          Using DurableStep and changing the approach we are able to run our "setup" without block but I was not able to find a way to remove the tail call of the build wrapper from CPS thread

          Lucas Machado added a comment - We are working on the fix. Our current limitation is actually the Tail call of a build wrapper. Using DurableStep and changing the approach we are able to run our "setup" without block but I was not able to find a way to remove the tail call of the build wrapper from CPS thread

          {quote} if setUp can be expected to take more than a second or so, then you must not implement SimpleBuildWrapper. {quote}

          jglick if we're not allowed to use SimpleBuildWrapper, then what is the approach we should take? Are there any examples we can reference of block pipeline steps that have a slow upfront component before entering the block (or cleanup after)? 

          Sean Sutherland added a comment - {quote} if  setUp  can be expected to take more than a second or so, then you must not implement  SimpleBuildWrapper . {quote} jglick if we're not allowed to use SimpleBuildWrapper, then what is the approach we should take? Are there any examples we can reference of block pipeline steps that have a slow upfront component before entering the block (or cleanup after)? 

          Jesse Glick added a comment -

          You can implement Step directly. I am not sure of a directly applicable example offhand.

          Jesse Glick added a comment - You can implement Step directly. I am not sure of a directly applicable example offhand.

            Unassigned Unassigned
            lucasam Lucas Machado
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: