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

Improvements for 'when' section

XMLWordPrintable

      It would be nice to improve when section in stage pipeline when user input and timeout.

      Currently we have to write code like this:

      when {
        boolean publish
        try {
          timeout(time: 1, unit: 'MINUTES') {
            input 'Deploy pages?'
            publish = true
          }
        } catch (final ignore) {
          publish = false
        }
      publish
      }
      

      Which is:

      • very long
      • bad practise (catch and ignore)
      • unclear

      My proposition is to make additional clause, which could look like this:

      when {
        input message: 'Deploy pages?', time: 1, unit: 'MINUTES', failWhenTimeout: false
      }
      

      Default parameters could be:

      • message: Proceed or Abort?
      • time: 5
      • unit: MINUTES
      • failWhenTimeout: false

            abayer Andrew Bayer
            staszek Piotr JoĊ„ski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: