We are currently configuring our email-ext plugin in Jenkins manually (as documented). For various reasons, we'd like to move this to a script being run (using the jobDsl
step). Probably most importantly, we need to be able to configure the smtp password programmatically and not requiring that someone paste it into a gui.
This doesn't seem to be documented anywhere. I've tried looking around in the email-ext plugin's source code, and ended up with this incomplete groovy-snippet:
import jenkins.model.Jenkins
import java.net.URL
ExtendedEmailPublisherDescriptor descr = ExtendedEmailPublished.getDescriptor()
MailAccount mailAccount = descr.getMailAccount()
withCredentials(...) {
mailAccount.setSmtpPassword(theCredentials)
}
...
I know too little about Jenkins plugins to know if I'm on the right track here.