Does POST section error makes Pipeline run unsuccessful?

44 Views Asked by At

I was going through Cloudbees Training Documentation for jenkins certification. In one of the section for Post it's mentioned that

An error in a post section does not make the Pipeline run unsuccessful

enter image description here

As I was unsure of this, I tried to create a simple pipeline and making it fail in Post section but as I was expecting it made the pipeline failed in red.

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                // Get some code from a GitHub repository
                git 'https://github.com/jglick/simple-maven-project-with-tests.git'

            }
        }
    }
    
    post {
        success {
            error("Build failed because of this and that..")
        }
    }
}

enter image description here

Am I missing something in that statement or statement itself is wrong?

0

There are 0 best solutions below