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

Supporting "post" steps at Pipeline and Stage level

    • iapetus, 1.0, Blue Ocean 1.0-rc3, Blue Ocean 1.0-rc4, Blue Ocean - 1.1-beta-1, Blue Ocean - 1.1-beta2, Blue Ocean 1.1-beta4

      Post steps

      • Runs after a stage has finished executing
      • Runs after a pipeline has finished executing

      Can run when:

      • Always - even if the steps before the post steps fail, the post steps will always run
      • Failed - runs only when the proceeding steps have failed
      • Success - runs only when the proceeding steps have passed
      • unstable - runs only when the proceeding steps have been marked as unstable
      • changed - runs only when the state has changed relative to the previous run
        • e.g. stage "foo" was success in run 1, then fails in run 2 would these steps ever be run

      https://jenkins.io/doc/pipeline/tour/post/

      Example

      pipeline {
          agent any
          stages {
              stage('No-op') {
                  steps {
                      sh 'ls'
                  }
              }
          }
          post {
              always {
                  echo 'One way or another, I have finished'
                  deleteDir() /* clean up our workspace */
              }
              success {
                  echo 'I succeeeded!'
              }
              unstable {
                  echo 'I am unstable :/'
              }
              failure {
                  echo 'I failed :('
              }
              changed {
                  echo 'Things were different before...'
              }
          }
      }
      

          [JENKINS-41959] Supporting "post" steps at Pipeline and Stage level

          James Dumay created issue -
          James Dumay made changes -
          Epic Link New: JENKINS-36291 [ 172300 ]
          James Dumay made changes -
          Sprint New: post-release [ 181 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Summary Original: Editor post steps New: Supporting "post" steps at Pipeline and Stage level
          James Dumay made changes -
          Sprint Original: post-release [ 181 ] New: iapetus [ 216 ]
          James Dumay made changes -
          Rank New: Ranked lower
          Brody Maclean made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          James Dumay made changes -
          Sprint Original: iapetus [ 216 ] New: iapetus, 1.0 [ 216, 221 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Rank New: Ranked lower

            jamesdumay James Dumay
            jamesdumay James Dumay
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: