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

Add optional 'timeout' parameter to 'input' step

    XMLWordPrintable

    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
            jrkoiter Joost added a comment - - edited

            The documentation doesn't say what the default unit is. This is working for me:

            node {
                timeout(time: 10, unit: 'SECONDS') {
                input "waiting..."
                }
            }
            
            Show
            jrkoiter Joost added a comment - - edited The documentation doesn't say what the default unit is. This is working for me: node { timeout(time: 10, unit: 'SECONDS' ) { input "waiting..." } }
            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.
            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
            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
            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 ... }

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: