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

Create a new option for running when condition before stage input

    XMLWordPrintable

    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

            elkins Erik Elkins created issue -
            elkins Erik Elkins made changes -
            Field Original Value New Value
            Summary Create a new stage option for running when condition before stage input Create a new option for running when condition before stage input
            ennef Christopher Fenner made changes -
            Link This issue is duplicated by JENKINS-52240 [ JENKINS-52240 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-52745 [ JENKINS-52745 ]
            abayer Andrew Bayer made changes -
            Assignee Erik Elkins [ elkins ] Andrew Bayer [ abayer ]
            jtaboada Jose Blas Camacho Taboada made changes -
            Assignee Andrew Bayer [ abayer ] Jose Blas Camacho Taboada [ jtaboada ]
            abayer Andrew Bayer made changes -
            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:
            {code:java}
            stage('Production Deploy') {
                agent { label 'linux' }
                when {
                 branch "master"
                    beforeInput: true
                }
                input { message 'Deploy to Production?' }
                steps {
                    echo 'Deploying to Production ... '
                }             
            }{code}
             
            *Use cases*
             * Evaluate the when condition before the input has been gathered.

            *In scope*
             * Declarative pipeline only
             * Only used for input at stage level https://jenkins.io/doc/book/pipeline/syntax/#input

             
            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:
            {code:java}
            stage('Production Deploy') {
                agent { label 'linux' }
                when {
                 branch "master"
                    beforeInput true
                }
                input { message 'Deploy to Production?' }
                steps {
                    echo 'Deploying to Production ... '
                }             
            }{code}
             
            *Use cases*
             * Evaluate the when condition before the input has been gathered.

            *In scope*
             * Declarative pipeline only
             * Only used for input at stage level https://jenkins.io/doc/book/pipeline/syntax/#input

             
            jtaboada Jose Blas Camacho Taboada made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-49947 [ JENKINS-49947 ]
            jtaboada Jose Blas Camacho Taboada made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              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: