本文介绍了Jenkins-如何通过Email-ext插件的"Culprits"电子邮件列表变量到构建步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Culprits(Culprits)是自上次不间断构建以来至今一直进行更改的用户列表. Jenkins Email-ext插件可以在构建后操作期间向罪犯发送电子邮件.Culprits is the list of users who committed a change since the last non-broken build till now. The Jenkins Email-ext plugin is able to send an email to the culprits during a Post-Build action.我想在Jenkins作业的python脚本构建步骤中使用Culprits定义的电子邮件列表.I want to use the list of emails defined by Culprits in a python script build step inside of my Jenkins job.谁能建议我该怎么做?推荐答案罪魁祸首"列表来自jenkins中的SCM插件,其中包括自上一次成功构建以来已提交的所有用户.最终,电子邮件扩展插件将从scm中获取其列表,并根据遵循启发式The 'culprits' list comes from the SCM plugin in jenkins and includes all users who have committed since the last successful build. Ultimately the email-ext plugin is sourcing its list from scm and generating the email addresses based on the following heuristic如果您的电子邮件地址具有某种模式(并且必须这样做,否则email-ext插件将无法生成正确的地址),那么您可以在groovy脚本中自己生成它们,例如:If your email addresses have some sort of pattern (and they must do, otherwise the email-ext plugin would not be generating the correct addresses) then you can generate them yourself inside a groovy script eg:import hudson.model.*def culprits = build.getCulprits()def list = culprits.collect{it.getFullName().toLowerCase().replace(" ", ".") + "@mydomain.com"}此示例会将"Adam Smith"之类的罪魁祸首转换为adam.smith@mydomain.com但是您可以将对getFullName()的调用替换为对getId()的调用,并进行适当的操作.例如:This example would convert a culprit like "Adam Smith" to adam.smith@mydomain.comBut you could replace the call to getFullName() with a call to getId() and manipulate that however appropriate. eg:def list = culprits.collect{it.getId().toLowerCase() + "@mydomain.com"} email-ext使用的基本格式是-您可以从文档.Which is the basic format that email-ext uses - You can get a full list of user properties from the documentation.现在您已经在一个普通脚本中使用了该列表,但是如何使该列表可用于您的python脚本呢?这将归结为您惯于做的事情.您可以将列表写入工作区并从python读取,或者将结果保存到环境变量,甚至保存到构建参数.Now you have the list in a groovy script, but how to make that list available to your python script? That will come down to what you are used to doing. You could write the list to your workspace and read it from python, or save the result to an environmental variable, or even save it to a build parameter. 这篇关于Jenkins-如何通过Email-ext插件的"Culprits"电子邮件列表变量到构建步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 16:36