2. Add this to Inject Environmental Variables section under "Properties File Path:
${WORKSPACE}/count.txt
ANOTHER SEPARATE PROPERTIES FILE PATH (as I have two variables)
${WORKSPACE}/distinctcount.txt
(note: workspace is pwd for jenkins and lists the location)
3. Call the variable in the "default content" section of "editable email notification":
Count total:$count Distinct Count: $distinctcount
**NOTE**
Be sure you have email setup as "always" under "advanced settings" at the bottom of the email settings, otherwise it only emails upon first success or any faillure:
question: when using a scripted pipeline, with the 'emailext' how do properly format the body of the email ?
Typically I define my own content/body with mimeType : 'text/html'
The body I put together using different kinds of data from my job. Here I use "<br>" as separator, which works will for items I add myself. But when adding stuff like '${BUILD_LOG}' (giving the truncated build log, no (html) newlines are inserted. I have even tried to replace '\n' by '<br>\n' like:
but that does not seem to have effect. I am guessing the that BUILD_LOG is only evaluated within the emailext plugin, so after my replace. How to achieve a replacement. Or better way of proper formatting?? Note: I could go for using a template, but that is a bridge too far right now ...
Comments
4 comments
Doesn't work. It does embed in the body of the email, but the css ad html files aren't embedded! Looks so unfinished!
Same here. did You find solution for that
similar - this worked for me though:
1. Add this to build: execute shell section:
echo count=$count > count.txt
echo distinctcount=$distinctcount > distinctcount.txt
2. Add this to Inject Environmental Variables section under "Properties File Path:
${WORKSPACE}/count.txt
ANOTHER SEPARATE PROPERTIES FILE PATH (as I have two variables)
${WORKSPACE}/distinctcount.txt
(note: workspace is pwd for jenkins and lists the location)
3. Call the variable in the "default content" section of "editable email notification":
Count total:$count Distinct Count: $distinctcount
**NOTE**
Be sure you have email setup as "always" under "advanced settings" at the bottom of the email settings, otherwise it only emails upon first success or any faillure:
question: when using a scripted pipeline, with the 'emailext' how do properly format the body of the email ?
Typically I define my own content/body with mimeType : 'text/html'
The body I put together using different kinds of data from my job. Here I use "<br>" as separator, which works will for items I add myself. But when adding stuff like '${BUILD_LOG}' (giving the truncated build log,
no (html) newlines are inserted.
I have even tried to replace '\n' by '<br>\n' like:
def emailLog = '${BUILD_LOG}'.replace('\n','<br>\n')
but that does not seem to have effect. I am guessing the that BUILD_LOG is only evaluated within the emailext plugin, so after my replace. How to achieve a replacement. Or better way of proper formatting??
Note: I could go for using a template, but that is a bridge too far right now ...
thx, M
Please sign in to leave a comment.