[英]Programmatically Configuring Jenkins Mailer Plugin in Groovy Script
As the title suggests, I am trying to configure the Mailer plugin in a Groovy script to set fields such as the username and password.正如标题所示,我正在尝试在 Groovy 脚本中配置 Mailer 插件,以设置用户名和密码等字段。 Is there a way to do that?
有没有办法做到这一点?
I have tried referencing the Jenkins API documentation and managed to get the plugin as such:我尝试参考 Jenkins API 文档并设法获得插件:
Jenkins.instance.pluginManager.getPlugin('mailer').getPlugin().configure(...)
However, I'm not sure if that "configure" method does what I need.但是,我不确定该“配置”方法是否满足我的需要。
This perhaps... ?这或许……?
from: https://github.com/Praqma/JenkinsAsCodeReference/blob/master/dockerizeit/master/globalconfig.groovy来自: https://github.com/Praqma/JenkinsAsCodeReference/blob/master/dockerizeit/master/globalconfig.groovy
def jlc = JenkinsLocationConfiguration.get()
jlc.setAdminAddress(config.global.jenkinsAdminEmail)
jlc.save()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.