I'm trying to get (and hopefully change) the Jenkins configuration for a plugin with a Groovy script inside the Groovy console. My specific example is to try to change multiple IP addresses for the publish-over-ssh plugin. It's pretty easy to do via the command line (editing the xml), but after hours of struggling with it, I'd still like to find how it would be done via the groovy console, for no other reason than the enlightenment. I've looked through the Jenkins API javadoc, but to no avail.
How can I find/change the global configuration for a plugin inside the Jenkins console?
Here is a good place to start searching:
Here is an example of adding a host:
import jenkins.model.* import jenkins.plugins.publish_over_ssh.BapSshHostConfiguration def inst = Jenkins.getInstance() def publish_ssh = inst.getDescriptor("jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin") def configuration = new BapSshHostConfiguration(name, hostname, username, encryptedPassword, remoteRootDir, port, timeout, overrideKey, keyPath, key, disableExec ) publish_ssh.addHostConfiguration(configuration) publish_ssh.save()
Here we can see a couple helpful functions:
Should be all the info you need to do it, cheers!