简体   繁体   中英

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. Is there a way to do that?

I have tried referencing the Jenkins API documentation and managed to get the plugin as such:

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

  def jlc = JenkinsLocationConfiguration.get()
  jlc.setAdminAddress(config.global.jenkinsAdminEmail)
  jlc.save()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM