Jenkins Console Log data fetching into variable to attach in Email :

2,036 views
Skip to first unread message

sumanth veera

unread,
Dec 3, 2015, 12:07:17 PM12/3/15
to Jenkins Users
Hi All...

Currently we have selenium script running in Jenkins to test in Development, QA, Production under single job. Everytime we change
Environment manually in configuration.xls file as part of selenium script as seen below
 
 
Selenium script wil take above URL specified in Environment Column which has value “Yes”.
i.e. jenkins will hit script on prod.123 url
 
Problem :
We want to attach Environment URL in Jenkins Notification Email. To do that we are currently printing Environment on Console log.
 
How do we filter this Environment value content from Jenkins Console log and assign  to varaiable to use this variable in Email Template.
 
Please suggest us how to resolve this ..
I got soultions that we can use XPATH or JSON filter.But can you suggest how to write script’s to filter console log with regular expression or
Any other approach solution..

Thanks
Sumanth Veera 

Victor Martinez

unread,
Dec 3, 2015, 2:05:31 PM12/3/15
to Jenkins Users
Hi,

 If you want to use a more standard way (IMO) I recommend you the below approach, then you won't need to worry about parsing any console output at all

 If you generate those environment variables on the fly then you can inject properties during the build phase via https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin (for instance via a properties file) then you can run a postbuild action to send an email with https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin and use those variables as part of the email.

I hope it helps,
Víctor
Reply all
Reply to author
Forward
0 new messages