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

Add optional 'timeout' parameter to 'input' step

    Details

    • Similar Issues:

      Description

      An optional 'timeout' parameter for the 'input' pipeline step would be very nice. In case of no response within specified amount of time, the build would then fail. Or maybe even make that selectable: fail or continue.

        Attachments

          Issue Links

            Activity

            Hide
            stodorov Steve Todorov added a comment - - edited

            I really don't know why is this marked as "fixed/won't fix". I've opened another ticket about the same issue - https://issues.jenkins-ci.org/browse/JENKINS-56259 

            It would be really great if there was a parameter for the `input` step. You cannot wrap this in a `timeout` when you are using it at a `stage(){ input {} }` level in a declarative pipeline. 

            Show
            stodorov Steve Todorov added a comment - - edited I really don't know why is this marked as "fixed/won't fix". I've opened another ticket about the same issue - https://issues.jenkins-ci.org/browse/JENKINS-56259   It would be really great if there was a parameter for the `input` step. You cannot wrap this in a `timeout` when you are using it at a `stage(){ input {} }` level in a declarative pipeline. 
            Hide
            abayer Andrew Bayer added a comment -

            Yeah, the appropriate way to do this is

            timeout(5) {
              input ...
            }
            
            Show
            abayer Andrew Bayer added a comment - Yeah, the appropriate way to do this is timeout(5) { input ... }
            Hide
            flash_1999 Vsevolod Kalinin added a comment -

            While in progress the [quite ugly] workaround is

                    long startTime = System.currentTimeMillis()
                    try {
                        timeout(time: timeoutInSeconds, unit: 'SECONDS') {
                            input 'Test'
                        }
                    } catch (err) {
                        long timePassed = System.currentTimeMillis() - startTime
                        if (timePassed >= timeoutInSeconds * 1000) {
                            echo 'Timed out'
                        } else {
                            throw err
                        }
                    }
            
            Show
            flash_1999 Vsevolod Kalinin added a comment - While in progress the [quite ugly] workaround is long startTime = System .currentTimeMillis() try { timeout(time: timeoutInSeconds, unit: 'SECONDS' ) { input 'Test' } } catch (err) { long timePassed = System .currentTimeMillis() - startTime if (timePassed >= timeoutInSeconds * 1000) { echo 'Timed out' } else { throw err } }
            Hide
            jglick Jesse Glick added a comment -

            Both return org.jenkinsci.plugins.workflow.support.steps.input.Rejection@53ed4813 for timeout and abort.

            Seems like a bug in InputStepExecution.stop; should pass its Throwable on to onFailure rather than having doAbort construct a new FlowInterruptedException. (IOW, factor this code into a new method and revert the impersonate call from the fix of JENKINS-38380.) Could be fixed in conjunction with providing a sandbox-safe accessor for FlowInterruptedException.getCauses and defining an integration test.

            Show
            jglick Jesse Glick added a comment - Both return org.jenkinsci.plugins.workflow.support.steps.input.Rejection@53ed4813 for timeout and abort. Seems like a bug in InputStepExecution.stop ; should pass its Throwable on to onFailure rather than having doAbort construct a new FlowInterruptedException . (IOW, factor this code into a new method and revert the impersonate call from the fix of JENKINS-38380 .) Could be fixed in conjunction with providing a sandbox-safe accessor for FlowInterruptedException.getCauses and defining an integration test.
            Hide
            jglick Jesse Glick added a comment -

            Jason Miller perhaps you are seeing JENKINS-38380. Do not discuss it here please.

            Show
            jglick Jesse Glick added a comment - Jason Miller perhaps you are seeing JENKINS-38380 . Do not discuss it here please.

              People

              • Assignee:
                Unassigned
                Reporter:
                jrkoiter Joost
              • Votes:
                6 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: