0

So I have a situation here.

I have to run a Python script to get some output - for example the image-id of my machine.

I want this output to be sent as part of the email that jenkins sends after the build has been over.

I already have a groovy script which does other activities like- collecting information from Robot output files - output.xml , report.html and log.html and send out the info in the email. I am using email-ext plugin and robot framework for automation.

Is it possible to run - "Pre-send Script" and send the output under "Default Content" in "Eidtable email notification" ?

Thanks in advance.

3
  • are you asking us how to configure jenkins? Or are you asking how to run a keyword in the robot test that does something? Commented Nov 7, 2016 at 14:17
  • i am trying to ask, how to make the output of a python script, to be displayed in the email sent by jenkins. @BryanOakley Commented Nov 7, 2016 at 15:35
  • You must be able to run your python script from pre-send script (groovy code ) output of which could be assigned to msg object. Commented Nov 8, 2016 at 5:22

1 Answer 1

1

Thanks all for the suggestions and solutions. Last night i used this groovy code to run my python script and pasted this groovy code under - "Default Content" of jenkins email-ext.

Code is as below :

<%
def sout = new StringBuffer(), serr = new StringBuffer()

def proc ='/var/lib/jenkins/email-templates/show_sys.py'.execute()
def b = new StringBuffer()
proc.consumeProcessErrorStream(b)
println proc.text
println b.toString()
%>

This is what I pasted in jenkins :

<h2 style="color:blue;font-size:100%;">${SCRIPT, template="vd.groovy"}</h2>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.