如何获得Jenkins关于创建新工作的Slack通知



我有一个Jenkins实例,里面有很多作业。这是公司开发人员共享的。每当有人在此实例上创建新作业时,我们的团队都希望得到通知。

在谷歌上搜索这很困难,因为我不是在寻找特定作业的信息,我想要一个实例范围的钩子,当在上面创建新作业时,它会提醒Slack。

这可能吗?也许通过插件?还是埋在什么地方?

我自己的问题的一个可能的解决方案是:https://support.cloudbees.com/hc/en-us/articles/226941767-Groovy-to-list-all-jobs#resolution

像这样的东西,特别是在";执行系统Groovy脚本";块

import jenkins.model.Jenkins
import hudson.model.*
// This script will print the name of all jobs including jobs inside of a folder, but not the folders themselves
Jenkins.instance.getAllItems(Job.class).each{ 
println it.name + " - " + it.class
}

然后根据这些结果发出警报。

最新更新