Hi,
I found a small groovy script to install automatically a set of plugins (including their dependencies):
def pluginParameter="ldap matrix-auth ssh-credentials"
def plugins = pluginParameter.split()
def instance = Jenkins.getInstance()
def pluginManager = instance.getPluginManager()
def updateCenter = instance.getUpdateCenter()
def installed = false
plugins.each {
if (!pluginManager.getPlugin(it)) {
def plugin = updateCenter.getPlugin(it)
if (plugin) {
println("Installing " + it)
def installationJob = plugin.deploy()
installed = true
}
}
}
instance.save()
if (installed)
instance.doSafeRestart()
I want to wait that plugins are effectively installed before proceeding with next instruction of the script. Plugin installation is asynch task. I tried to use plugin.deploy.get() as deploy() returns a Future but the script ends before all plugins and dependencies are effectively installed. Is there a way to wait until plugins and dependencies are effectively installed?
Regards,
Christophe