Send email based on script output

20 views
Skip to first unread message

varun umesh

unread,
Feb 25, 2016, 10:31:32 PM2/25/16
to Jenkins Users

I have test automation framework, and the test runs are driven through Jenkins. After the test run is completed, it generates a few custom test reports, as html file. In the report, i have a table with total number of errors as one of the column. I basically want to parse this html file and send out an email to a mailing list if the error is greater than 0.

Here is what i have done till now, in my Jenkins job:

a. Configured the job to run the tests [this is in an execute shell option and running my jar, as the test framework is a java application]
b. I have a post build action, in which i execute a python code, which does the following:

Step 1. Get the latest html report.
Step 2. Parse this file.
Step 3. If the error is > 0:
then email_flag = true
else:
email_flag = false.

Now is there a way i can use the above flags and send email notifications, via Jenkins plugins? I just want to understand the best way to do this. Any help is appreciated.

P.S. I did some additional research and i see the Email-ext plugin [https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin] has a pre-send script option, but i just don't know how to use this to run the python code and handle the email messaging.

niristotle okram

unread,
Feb 26, 2016, 1:39:07 AM2/26/16
to jenkins...@googlegroups.com
i can't recall the exact name but there is a jenkins option to execute some groovy script. (if you are still using the old jenkins jobs NOT pipeline). So based on the flag, execute the script that triggers the mail

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8d43e8cb-d59c-4c9a-b732-8a1a029a813e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards
nirish okram
Reply all
Reply to author
Forward
0 new messages