Email-ext Jenkins plugin localization - email

I'm using Jenkins as CI tool, and Email-ext plugin to send e-mail notification. Jenkins runs on Win2003 with En locale, I'm launching job from browser with Ru locale.
So I get e-mail with russian letter in incorrect encoding. How I can set email locale to en?
PS: I need all text in English, becaluse some teammates don't know russian.
PPS:I'm using jelly script "html-with-health-and-console.jelly",
string ${build.durationString} contains russain chars and ${healthReport.description}

Related

Use Jenkins to read email, download attachment, and run a script

I'm trying to configure the poll-mailbox-trigger-plugin to do this but having trouble setting it up. Unsure if downloading an attachment is possible with this plugin.
Here's what I'm trying to do
Jenkins reads email
If subject = "My Subject", download its attachment to /opt/file.csv
Run /opt/script.py
I'd like to do this in Jenkins but I may settle to write a script that can do all of the above steps instead and then have Jenkins just monitor it somehow.
Any suggestions?
Edit: There is an open feature request for this jenkins plugin for exactly this functionality.
https://issues.jenkins-ci.org/browse/JENKINS-27575
Downloading attachments is now available since version 1.022.

Jenkins email-ext plugin encoding seting for emailable-report.html

I am using email-ext plugin in my job to send the generated TestNG report via email. I have some Japanese characters in the generated emailable-report.html.
My email-ext plugin config looks like this:
But when received the email, all the Japanese characters in the emailable-report.html report doesn't show as expected.Instead, they show like this:
I searched google but don't find anywhere I can set the encoding. Does anybody know what the problem is?
BTW: In Manage Jenkins-->Configure System-->E-mail Notification--Charset, I've already set the value to 'utf-8'.
Try adding -Dfile.encoding=UTF-8 to JAVA_OPTS.

How to send nunit results from jenkins to email

I've set up my jenkins to send emails after nunit tests are passed. How can I configure that the body of mail contains nunit results from TestResult.xml file? Maybe there is some plugin to jenkins?
I think you should take a look to the Email-ext plugin, it will allow you to decide what you want to send (and in your cae attach NUnit report).
I've found suitable solution for me: use Jelly script as described here:
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

How do I attach a build log to an e-mail notification with the Jenkins plugin Email-ext?

Version 2.15 of Jenkins plug-in Email-ext added support for attaching files to build notification e-mails. I would like to have the build log attached to build notification e-mails, but I can't figure out how to do it.
The build log appears to be stored on the Jenkins master node (in this case, Ubuntu Linux). For example, /var/lib/jenkins/jobs/<PROJECT_NAME>/builds/<DATE_TIME>/log. Naturally, the build log path changes with every build. The Email-ext file attachment feature defaults to using files from within the project workspace, which is on the Jenkins slave build machine (in this case, Mac OS X). For example, I configured my slave to use the folder /Users/<USERNAME>/Jenkins/build_agent/workspace/<PROJECT_NAME>/.
Is there any way to get Email-ext to attach a file from the master's file system, instead of the workspace on the slave build machine?
Thanks in advance to anyone who can offer some advice. The Email-ext wiki page currently does not contain an example of how to configure attachments.
You may just use ${BUILD_LOG, maxLines, escapeHtml} token in the body of the e-mail to include the build log.
Quoting the email-ext plugin doc (available here):
"To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen"
The plugin DOES support attaching the build log, you just need to check the box in the project configuration.
After sleeping on the problem and doing more research, I came to the conclusion that Email-ext does not support the attachment of a build log to a build notification e-mail.
However, I did come up with a sneaky work-around to use until such a feature is available: I use the Jenkins build tokens to generate the appropriate command to copy the log file from the master server to the slave's build workspace (see note below).
In the project, after the main compilation step, I added a new Execute shell step to generate the appropriate scp (secure copy) command. This is the command (replace USER and HOSTNAME with your own values, and you'll probably need to tailor the path to suit your individual server):
scp USER#HOSTNAME:/var/lib/jenkins/jobs/$JOB_NAME/builds/$BUILD_ID/log build.log
Then, in the Email-ext Attachments field of the Email-ext plugin, I entered:
build.log
Now the build log is copied from the master to the slave's workspace and attached to build notification e-mail messages. I have removed the $BUILD_LOG token from the message body template.
Note: to use this particular technique, you'll need to have passwordless ssh configured between the slave and the master, perhaps using an OpenSSH key passphrase. If you need help with that, search around the web for information on the ssh-keygen command, and perhaps check tutorials like this one. A similar approach should work on platforms that do not have built-in support for SSH. RoboCopy or similar should work on Windows systems.
EDIT: The Email-ext plug-in now has the ability to attach a build log to a notification message with a check-box on the job's configuration screen. See slide's answer for an example.
When using Jenkinsfile, add attachLog: true to the emailext configuration, like:
emailext attachLog: true, body: '', subject: ''
Credit to #Spencer Malone in Jenkins pipeline - Notify with console error log through email
Firsl of all You have to install Email Ext plugin.After installing follow this step.
Now in to the 'Add post-build action’ select Editable Email Notification and in that section you have option Attach build Log.select option as below in picture.
after that apply and save.Now you will definitely get Build Log in Email attachment.
Thank You.
I have noticed that when i check the box to attach build log, it also unchecks after saving, however it is attached in my emails after the email has been submitted.

Hudson email triger

I like to send email using hudson ext-email plugin, but with diferent triger than build status. I like to set hudson evn during buil or read it from env file (using env-file plugin) and depends of his value send email or not. How to do that?
BR.Marcin
To conditionally send out an email based on an environment variable set in the build, you'll have to use a scripting language such as Groovy.
Here's an article discussing how to use a Groovy script inside Email-ext.