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

Create a new option for running when condition before stage input

    Details

    • Similar Issues:

      Description

      Currently, when using the "stage-level" input (here: https://jenkins.io/doc/book/pipeline/syntax/#input) the when condition of the stage is evaluated after the input is gathered.  We should add an option so the when condition is evaluated before the input is gathered. Something like:

      stage('Production Deploy') {
          agent { label 'linux' }
          when {
              branch "master"
              beforeInput  true
          }
          input { message 'Deploy to Production?' }
          steps {
              echo 'Deploying to Production ... '
          }             
      }

       
      Use cases

      • Evaluate the when condition before the input has been gathered.

      In scope

       

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            This’ll be in 1.3.3

            Show
            abayer Andrew Bayer added a comment - This’ll be in 1.3.3
            Hide
            johanrydstrom Johan Rydström added a comment -

            Looks good!

            Q: Can I, and if so how can I make the result of the captured input (the approver) available in a variable?

            Show
            johanrydstrom Johan Rydström added a comment - Looks good! Q: Can I, and if so how can I make the result of the captured input (the approver) available in a variable?
            Hide
            tkleiber Torsten Kleiber added a comment -

            Thanks, works as requested.

            Show
            tkleiber Torsten Kleiber added a comment - Thanks, works as requested.
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.
            Hide
            alecharp Adrien Lecharpentier added a comment -

            Just a warning, the beforeInput is not documented in the article nor in the snippet generator. I just faced this and the only solution is in Torsten's comment.

            Show
            alecharp Adrien Lecharpentier added a comment - Just a warning, the beforeInput is not documented in the article nor in the snippet generator. I just faced this and the only solution is in Torsten's comment .

              People

              • Assignee:
                jtaboada Jose Blas Camacho Taboada
                Reporter:
                elkins Erik Elkins
              • Votes:
                9 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: