gpt4 book ai didi

jenkins - 如何在具有一个或多个 SCM 的 Jenkins 工作流程中找到罪魁祸首或提交者

转载 作者:行者123 更新时间:2023-12-04 13:16:05 26 4
gpt4 key购买 nike

从一个或多个 SCM(通过 checkout() 或其他 SCM 步骤如 git/svn) checkout 时,是否可以访问有关 Jenkins 工作流作业的提交者和/或罪魁祸首的信息?

目的是使用该信息通知提交者和/或罪犯有关作业状态的信息,例如在 mail 中。步。

工作流定义的一个小例子:

node {
// checkout from one or more SCMs, e.g.
git url: '<URL>'
checkout([$class:...])
...

// how can we know about committers or culprits at this point?
$committers = ??

// send a mail to committers or culprits
mail to: '$committers', subject: 'JENKINS', body: '<information about the job status>'
}

在运行 SCM 步骤后,如何调整以获取提交者的集合?

编辑:
我目前正在使用 Jenkins 1.596.2 版和 Workflow: Aggregator 1.6 版,这似乎是 JENKINS-24141 中的一个 Unresolved 问题

最佳答案

现在可以使用 email-ext插入。

def to = emailextrecipients([[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']])
if (to != null && !to.isEmpty()) {
mail to: to, subject: "JENKINS", body: "See ${env.BUILD_URL}"
}

但是,如果您只想发送有关失败的电子邮件,您可能需要使用 Mailer(基于 email-ext pipeline examples):
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'],
[$class: 'RequesterRecipientProvider']])])

关于jenkins - 如何在具有一个或多个 SCM 的 Jenkins 工作流程中找到罪魁祸首或提交者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30398465/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com