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

Allow input timeout parameter

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have been wondering for ages why is there no `timeout` option in the `input` step? I am aware you can wrap your input in a `timeout() {}`, but that is just impossible when you are using the `input` as part of the stage like so:

       

      pipeline {
          agent any
          stages {
              stage('Example') {
                  input {
                      message "Should we continue?"
                      ok "Yes, we should."
                      submitter "alice,bob"
                      parameters {
                          string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
                      }
                  }
                  steps {
                      echo "Hello, ${PERSON}, nice to meet you."
                  }
              }
          }
      }

       

      (Taken from https://jenkins.io/blog/2018/04/09/whats-in-declarative/#input)

       

      The possible "workaround" to this would be to create an `input` step in a previous stage which is wrapped in a `timeout` step, but in our case this makes things even more complicated and hard to read. 

      Are there any plans to include an `timeout` parameter for the `input` step? Maybe something like this (or better?):

       

      input { 
        message "Should we continue?" 
        ok "Yes, we should." 
        submitter "alice,bob" 
        timeout: [time: 1234, unit: 'MINUTES']
        parameters { 
          string(
            name: 'PERSON', 
            defaultValue: 'Mr Jenkins', 
            description: 'Who should I say hello to?'
          ) 
        }
      }

       

       

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Specific to Declarative Pipeline; adjusted component accordingly.

            Show
            jglick Jesse Glick added a comment - Specific to Declarative Pipeline; adjusted component accordingly.
            Hide
            stodorov Steve Todorov added a comment -

            Jesse Glick thanks for fixing that! Apologize for the wrong component

            Show
            stodorov Steve Todorov added a comment - Jesse Glick thanks for fixing that! Apologize for the wrong component
            Hide
            carlspring carlspring added a comment -

            Hi Jesse Glick

             

            Is there any update on this?

             

            Show
            carlspring carlspring added a comment - Hi  Jesse Glick ,    Is there any update on this?  
            Hide
            markv Mark Vinkx added a comment -

            You simply can wrap the input in a timeout 

                    stages {
                        stage('Deploy') {
                            steps {
                                        timeout(time: 5, unit: "MINUTES") {
                                            input message: 'Do you want to approve the deploy?', ok: 'Yes'
                                        }
                                        sh './flakey-deploy.sh'
                             }
                        }
                    }
            
            Show
            markv Mark Vinkx added a comment - You simply can wrap the input in a timeout  stages { stage( 'Deploy' ) { steps { timeout(time: 5, unit: "MINUTES" ) { input message: 'Do you want to approve the deploy?' , ok: 'Yes' } sh './flakey-deploy.sh' } } }
            Hide
            jglick Jesse Glick added a comment -

            Mark Vinkx this is about input as part of a stage rather than one of its steps, which has different behavior (if I understand correctly) with respect to when an executor is locked.

            Show
            jglick Jesse Glick added a comment - Mark Vinkx this is about input as part of a stage rather than one of its steps , which has different behavior (if I understand correctly) with respect to when an executor is locked.
            Hide
            stodorov Steve Todorov added a comment -

            Mark Vinkx Yes, you could wrap the input like that, but unfortunately this means that you will allocate an agent and have it do nothing for 5 minutes. Also the Blue Ocean UI would display this stage as "passed" (green) which will be (and is) confusing, because you never know if the stage has actually passed or it has been skipped/not approved - you will need to specifically go into the stage to check the steps, whereas if you have it as a stage input it would show in the UI as skipped. 

            Jesse Glick yes, you've understood me correctly

            Show
            stodorov Steve Todorov added a comment - Mark Vinkx Yes, you could wrap the input like that, but unfortunately this means that you will allocate an agent and have it do nothing for 5 minutes. Also the Blue Ocean UI would display this stage as "passed" (green) which will be (and is) confusing, because you never know if the stage has actually passed or it has been skipped/not approved - you will need to specifically go into the stage to check the steps, whereas if you have it as a stage input it would show in the UI as skipped.  Jesse Glick yes, you've understood me correctly

              People

              • Assignee:
                Unassigned
                Reporter:
                stodorov Steve Todorov
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: