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

          Brody Maclean added a comment -

          Pipeline Settings
          https://invis.io/Q2A110KM9#/233893917_Editor-Home_W_Parallels
          [https://zpl.io/1h9jFU
          ]

          Stage
          [https://invis.io/Q2A110KM9#/233884743_Editor-Reorder_Parallels
          https://zpl.io/Z1FptFb

          https://invis.io/Q2A110KM9#/233884743_Editor-Reorder_Parallels]

          Animation & timing
          http://codepen.io/brody/pen/gWZvrr

          Brody Maclean added a comment - Pipeline Settings https://invis.io/Q2A110KM9#/233893917_Editor-Home_W_Parallels [https://zpl.io/1h9jFU ] Stage [https://invis.io/Q2A110KM9#/233884743_Editor-Reorder_Parallels https://zpl.io/Z1FptFb https://invis.io/Q2A110KM9#/233884743_Editor-Reorder_Parallels] Animation & timing http://codepen.io/brody/pen/gWZvrr

          James Dumay added a comment -

          brody thanks mate!

          James Dumay added a comment - brody thanks mate!

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

              Created:
              Updated: