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>
Oh, I just noticed that you are using the mail step, that one doesn’t support tokens like BUILD_LOG. You would need to use the emailext step (Email Extension Plugin) which is part of the email-ext plugin (Email Extension).
Yes, switching from mail to emailext was the right way to go. Like @slide_o_mix said, it gave me access to the ${BUILD_LOG} token/variable, which let me include the last 100 lines of it in email notifications whenever I have a task that fails.