Jenkins setup:
Jenkins: 2.479.1
OS: Linux - 6.8.0-48-generic
Java: 17.0.13 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
I have a pipeline that sends an email when the pipeline fails. I would like to include the last 100 lines of the console output in the email message. How do I get that?
The part below that I am having trouble with is <pre>\${BUILD_LOG, maxLines=100, escapeHtml=false}</pre>
mail bcc: '',
body: """
<p>Pipeline Failed: ${env.JOB_NAME} #${env.BUILD_NUMBER}</p>
<p>Build URL: ${env.BUILD_URL}</p>
<p>Build Log (Last 100 Lines):</p>
<pre>\${BUILD_LOG, maxLines=100, escapeHtml=false}</pre>
""",
cc: '',
charset: 'UTF-8',
from: 'noreply@email.com',
mimeType: 'text/html',
replyTo: 'noreply@email.com',
subject: "Pipeline Failed: ${env.JOB_NAME} ${env.BUILD_NUMBER}",
to: "recipient@email.com";