pipeline { agent any stages{ stage('unit test'){ steps{ sh """ echo "Hey" echo "Ho" echo "Hi" echo "${env.BRANCH_NAME}" echo "aaaa" """ } } } post { always { script { // Hack to have the 'jenkins build back to normal' mail sent if (currentBuild.result == null) { currentBuild.result = 'SUCCESS' } if (env.BRANCH_NAME == 'master') { step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "manukaz@gmail.com", sendToIndividuals: true]) } else { step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])]) } } } } }