As I want to configure that if my Quality Gate of Sonar Qube gives status error, it should not allow any thing in the body but Send email from Email Ext in Jenkins Pipeline.
stage("Quality Gate"){
steps{
script{
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
post {
always {
emailext attachmentsPattern:'Cucumber HTML Reports/$BUILD_NUMBER/cucumber-html-reports.zip' ,body:"$EMAILTEMPLATE$URLS $SONARQUBE ", mimeType: 'text/html', recipientProviders: [developers()], subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', to: ' xyz@abc.com'
}
}