Hi all,

Has anyone come to a satisfactory way to know the build status during 
pipeline model definition in terms of things like emailing on build state 
changes?  Nominally, we only want to email folks on failures and on build 
state changes, but I want the email to be able to say why the build state 
has changed.

With pipeline model definition, we can catch these events.  The problem is 
that we don't know why we received a changed {} state.  Here's a simple mvn 
build...

pipeline {
    agent label:'docker'

    stages {
        stage('maven-build') {
            steps {
                sh 'mvn clean install'
            }
        }
    }

    post {
        always {
            archiveArtifacts artifacts: '**/target/*.jar', fingerprint: 
true                
            step([$class: 'JUnitResultArchiver', testResults: 
'**/target/surefire-reports/TEST-*.xml'])
        }

        changed {
            sendEmail(config, 'CHANGED')
        }

        failure {
            sendEmail(config, 'FAILURE')
        }
    }    
}

Inside of this, I want to email on 'changed', but I really want the email 
to say whether or not I changed from SUCCESS to FAILURE or from FAILURE to 
SUCCESS.  I can't figure out how to do this.  Both ${currentBuild.result} 
and ${currentBuild.rawBuild.result} are unset.  Is there some way to know 
what the state change was from?  Right now, I can email, but the email 
won't know whether or not the current state is pass or fail.

Thanks for any help.  I'm assuming that it's me since this seems like a lot 
of work for something that is a pretty default case.

Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b3104aad-c29f-4c03-ada4-011b4c3000fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to