0

Below is the skeleton of my Jenkinsfile. The post directive is executed on success but not in case of failure. Is this the expected behavior of jenkins?

Thanks

#!/usr/bin/env groovy
pipeline {
  agent {
    node { label 'ent_linux_node' }
  }
  stages {
    stage('Prepare'){
      steps {
        //some steps
      }
    }
    stage('Build') {
      steps {
        //Fails at this stage
      }
    }
    stage('ArtifactoryUploads') {
      steps {
        //skips since previous stage failed
      }
    }
  }

  post {
    always {
      //Doesn't get executed but I am expecting it to execute
    }
  }
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Popinjoy
  • 23
  • 4
  • 1
    Check the doc: https://jenkins.io/doc/book/pipeline/syntax/#post there is an example, try using first this simple example and if works, add your code. – dcalap Jan 03 '19 at 11:42
  • **success** and **failure** works but **always** doesn't work all the time – Popinjoy Jan 09 '19 at 10:11
  • Tested right now with Jenkins 2.138.2. I've executed the sample code from the doc I linked and performed 10 builds. All of them printed _I will always say Hello again!_ so, I can't reproduce your error. – dcalap Jan 09 '19 at 10:38

0 Answers0