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

Post when stage is skipped due to when conditional

    Details

    • Similar Issues:

      Description

      The following pipeline does not trigger the post section:

      pipeline {
          agent any
      
          stages {
              stage('Test') {
                  when {
                      expression { return false; }
                  }
                  steps {
                      echo 'working'
                  }
                  post {
                      always {
                          echo 'post'
                      }
                  }
              }
          }
      }
      

      I expected this to actually echo 'post' and for post to also have a 'skipped' option. Would love to see those.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            post on a stage is part of the stage. So if the stage is skipped due to when, that includes the post.

            Show
            abayer Andrew Bayer added a comment - post on a stage is part of the stage . So if the stage is skipped due to when , that includes the post .
            Hide
            omervk Omer van Kloeten added a comment -

            Andrew Bayer thanks for the quick reply. I did not mean this was a defect, just different than what I expected.

            It could be a good idea to add something in the docs about this.

            Show
            omervk Omer van Kloeten added a comment - Andrew Bayer thanks for the quick reply. I did not mean this was a defect, just different than what I expected. It could be a good idea to add something in the docs about this.

              People

              • Assignee:
                Unassigned
                Reporter:
                omervk Omer van Kloeten
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: