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.

          [JENKINS-47577] Post when stage is skipped due to when conditional

          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.

          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 .

          abayer 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.

          Omer van Kloeten added a comment - abayer 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.

          Brian J Murrell added a comment - - edited

          I would also add, that being able to something when a stage is skipped would be useful.  An example might be to update a CI reporting system (such as Github's commit status checks) that a stage is not being waited for (indefinitely) but rather has been skipped.

          Could we have this This is reopened as an RFE for some such kind of functionality rather than having to re-invent when processing inside the stage since it's not possible to reflect the skipped status of a stage at that point?

          Brian J Murrell added a comment - - edited I would also add, that being able to something when a stage is skipped would be useful.  An example might be to update a CI reporting system (such as Github's commit status checks) that a stage is not being waited for (indefinitely) but rather has been skipped. Could we have this This is reopened as an RFE for some such kind of functionality rather than having to re-invent when processing inside the stage since it's not possible to reflect the skipped status of a stage at that point?

          Reopening as RFE.

          Brian J Murrell added a comment - Reopening as RFE.

          Re-closing as I did not see the related issue JENKINS-49944 on this one.

          Brian J Murrell added a comment - Re-closing as I did not see the related issue JENKINS-49944 on this one.

            Unassigned Unassigned
            omervk Omer van Kloeten
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: