【问题标题】:Integrating jenkins email plugin to print out the output of a python script in email集成 jenkins 电子邮件插件以在电子邮件中打印出 python 脚本的输出
【发布时间】:2017-03-20 19:30:59
【问题描述】:

所以我这里有一个情况。

我必须运行 Python 脚本才能获得一些输出 - 例如我机器的图像 ID。

我希望将此输出作为 jenkins 在构建结束后发送的电子邮件的一部分发送。

我已经有一个 groovy 脚本,它可以执行其他活动,例如从机器人输出文件 - output.xml、report.html 和 log.html 收集信息,并在电子邮件中发送信息。 我正在使用 email-ext 插件和机器人框架进行自动化。

是否可以运行-“预发送脚本”并在“Eidtable 电子邮件通知”中的“默认内容”下发送输出?

提前致谢。

【问题讨论】:

  • 你问我们如何配置jenkins?或者你是在问如何在机器人测试中运行一个关键字来做某事?
  • 我想问,如何使 python 脚本的输出显示在 jenkins 发送的电子邮件中。 @BryanOakley
  • 您必须能够从可以分配给 msg 对象的预发送脚本(groovy 代码)输出运行您的 python 脚本。

标签: python jenkins jenkins-plugins robotframework


【解决方案1】:

感谢大家的建议和解决方案。 昨晚我使用这个 groovy 代码来运行我的 python 脚本并将这个 groovy 代码粘贴到 - jenkins email-ext 的“默认内容”下。

代码如下:

<%
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()
%>

这是我在 jenkins 中粘贴的:

<h2 style="color:blue;font-size:100%;">${SCRIPT, template="vd.groovy"}</h2>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-06
    相关资源
    最近更新 更多