Jenkins: How do I include the commit message/description from Mercurial when using emailext?

Viewed 31

Is it possible to add the commit message/description to the email returned by Jenkins please?

Below is a highly redacted version of the jenkins script, to give you an idea of what I'm doing:

pipeline {
    agent any
    options {
        timeout(...)
    }
    stages {
        ...
        
        stage ('Pull') {
            steps {
                checkout([$class: 'MercurialSCM', credentialsId: '...', installation: '...', subdir: '...', source: '...'])
            }
        }
        stage ('...') {
            steps {
                ...
            }
        }
        ...
    }
    post {
        ...
        
        failure {
            emailext attachLog: true, body: '$DEFAULT_CONTENT',
            recipientProviders: [
                [$class: 'CulpritsRecipientProvider'],
                [$class: 'DevelopersRecipientProvider'],
                [$class: 'RequesterRecipientProvider']
            ],
            replyTo: '$DEFAULT_REPLYTO',
            subject: '$DEFAULT_SUBJECT',
            to:      '$DEFAULT_RECIPIENTS'
        }
        
        ...
    }
}

Any help much appreciated.

0 Answers
Related