input directive is not respecting when condition

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      In a descriptive pipeline I would like to have a user input directive that is only active for a certain branch:

      pipeline{
          agent none
          stages {
              stage ('build') {
                  agent any
                  when { anyOf { branch 'master'; branch 'PR-*' } }
                  steps {echo "build done"}
              }
              stage ('release') {
                  agent any
                  when { branch 'master'}
                  input {message 'Do you want to publish a new release?'}
                  steps {echo "release done"}
              }
          }
       }
      

      Currently the input is raised but the stage is then skipped.

      This could be done with a dedicated stage and the input step, but I would like to use the coding above.

      The beforeAgent options seems not to do the trick.

      when {
        beforeAgent true
        branch 'master'
      }
      

            Assignee:
            Andrew Bayer
            Reporter:
            Christopher Fenner
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: