How do I see detailed log messages from Jenkins emailing? - jenkins

I am having trouble getting email-ext working. I've looked at the system log ("Manage Jenkins"/"System Log"), and it shows the job succeeded in running, but nothing about how email works.
Is there some way to turn up logging so I can watch the emailing portion of either default or email-ext firing? Maybe I can tell why email is not working if I can see what it's trying to do.
Edit: We're running Jenkins 1.484.

you can do this:
go to configure system-system log,and add a new recorder
Choose a name that makes sense to you.
configure loggers and their levels whose output you'd like to collect
you can look there:https://wiki.jenkins-ci.org/display/JENKINS/Logging

Related

Modify notifications on a running build in jenkins

I occasionally want to get notified when a particular jenkins job that is building finishes. Is there any way to do this?
Scripting it through the API would be fine. I already have the jenkins IRC bot that notifies me of many things, so if I could just dynamically modify the running job build, that would be enough to do what I want -- I'm just having a hard time finding how to accomplish that.
AFAIK, you cannot change a job's config while it's running.
Here is an idea: Use a post-build step to check for an external resource status (like a file containing an action by text) and running an action based on the content of the file.
The external file can be modified while the build is running, so when the post-build is executed, it will follow the logic defined based on the content of the file.
I hope this helps.
You can use email notifier, It will send you an email
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

Jenkins email-ext plugin "ghost" configuration issue

We have an old install of Hudson (ver. 1.379, yes that old...) that hasn't been upgraded yet (and I am not quite sure when and if it will be by the people responsible for it).
There seems to be some place, apparently unaccessible from the web interface, were additional recipients for the email-ext plugin were added...
Problem is, those recipients no longer exist and quite a few people (mostly unrelated to the people who use Hudson) get spammed by bounces from those emails...
For email-ext I get this in the plugin page:
version: 2.12 installed: 2.8
I have looked at the configs and I believe email-ext config should be under "Editable Email Notification" of that job...
I see some of the recipients of those emails but not the person who left, it looks like this was configured elsewhere, maybe manually in some sort of config file.
Where can I look for this?
Thank you!
Puzzled!
There is global configuration. Go to Manage Hudson, then Configure System (the wording my be different based on your version, but you should end up here http://<hudsonurl>/configure. You need to have global administrative permissions to access this, but based on what you are saying, it sound like you do not.
Based on your version of the plugin, under Extended E-mail Notification, you will see Default Recipients. Older versions of the plugin did not have that feature.
Also, under the job configuration itself, there are several places to override/add to the list of recipients, the most buried of which is under the Triggers
Click Advanced... button under Editable Email Notification
For each trigger, click Expand link.
Lastly, it is possible that people are included on the emails cause they were Culprits. In Hudson's terms, these are people who committed to SCM since the last successful build. If the build has been failing since then for a long time, they are just there as culprits. The only way to "reset" the culprits is to let the job build successfully

Change Jenkins default 'Build Status' settings

I was wondering if it is possible to change the built-in build statuses that are reported by Jenkins via email (i.e. Still Failing, Failure, etc..)? I was looking into the groovy post build plugin, but I can't seem to get the code to change the build status.
Here is my simple code:
if(manager.logContains(".*xyz.*")) {
manager.buildSuccess()
}
Also, if someone could post where I can learn more about using Jenkins w/groovy to access Jenkins configuration settings, that would be great. I search the web but did not find anything to useful.
Thanks for any help,
Eric
For changing the E-mail messages i would suggest the E-Mail-ext plugin
For changing status, you may like to try the Jenkins Text Finder plugin.

How can I report the test results from a TestNG/Maven/Jenkins tests, via Email and attach screenshot?

I have some SeleniumWebdriver/TestNG/Maven/Java continuous integration tests, that I run in Jenkins.
Every time a test fails, a screenshot of the error is created.
How can I configure Jenkins to send an email to certain people and attach the screenshot upon failure?
The screenshot is located in this directory:
/mnt/www/jenkins/jobs/Integration tests/workspace/target/surefire-reports/
and its name is generated as a combination of a timestamp and the error that has occured, like this:
2013-7-6-12-1-30-UnabletolocateelementmethodlinktextselectorApprove.jpg
Screenshots arent automatically deleted, so there could be quite a few screenshots in that dir.
So, how can I make Jenkins send me the report with the screenshot attached?
OR Can I make TestNG do that? How?
Actually, no need to work with Jenkins, it can be done within the code of the test itself.
Generate the screenshot as described here:
Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?
then install the Java Mail API and a SMTP mailer service on your computer and make your code send email with the screenshot as an attachment upon failure.

How to have output of script emailed from Jenkins?

I am setting up a Jenkins job that processes some data.
Once the job is finished, I would like to have jenkins run a script that describes the status of the recent processing and email the stdout of that script to a specified email address.
While I realize that it is possible to have the script send the email itself, I am wondering if there exists a more ideal way to have Jenkins send the output of that script. Is there a plugin that is idea for this?
Thanks.
To configure the Email-ext plugin:
To get a portion of the log in the mail, if not all, set the 'Extended E-mail Notification' to send an email for each build that failed, and use the $BUILD_LOG in the body of the message:
In the body of the message (below the '$DEFAULT_CONTENT' ) add the parameter $BUILD_LOG to display the end of the build log
Assuming the log is in plain-text, change 'Content Type' to Plain Text
For the list of built-in Jenkins parameters, go to this page:
http://[your-jenkins-server]/env-vars.html
Cheers
EDIT:
To get to that list of available env-vars via the UI,
there is a link at the Execute shell build-step, for example -
I'm not sure if this is exactly what you're looking for, but the Email-ext plugin for Jenkins sounds like it may do what you want.

Resources