Created
June 29, 2018 15:02
-
-
Save teeks99/d7c331b3f66a9fe6507cfdaaabbd9229 to your computer and use it in GitHub Desktop.
Jenkinsfile with e-mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
stages { | |
stage('Build'){ | |
steps { | |
echo "Running job: ${env.JOB_NAME}\nbuild: ${env.BUILD_ID} - ${env.BUILD_URL}\nblue ocean: ${env.RUN_DISPLAY_URL}" | |
} | |
} | |
} | |
post { | |
failure { | |
mail to: 'notify-list@example.com', from: 'jenkins@example.com', | |
subject: "Example Build: ${env.JOB_NAME} - Failed", | |
body: "Job Failed - \"${env.JOB_NAME}\" build: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you, this is very well explained and presented. exactly what I needed.
Note: You can also add "${currentBuild.fullDisplayName}" and "${currentBuild.currentResult}" for niceness.