user5056973
user5056973

Reputation: 447

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.

Upvotes: 0

Views: 221

Answers (1)

Ian W
Ian W

Reputation: 4777

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()

Upvotes: 1

Related Questions