Here is the Groovy script that I use to create an install script (using
Jenkins CLI) of the plugins on the server .
You can also modify it if you just want to get the list of your plugins
(and their versions)
I have found this useful for cloning the plugins of one server to another.
Hope it helps.
/*
* Generates command to install all plugins on this server
* to a remote server whose name is passed in as a variable
* Helpful utility script for cloning the plugin environment of a server
* Author: Ioannis K. Moutsatsos
*/
import jenkins.model.*;
def destinationServer='jenkinsDestinationServer' //modify this for you
destination server
def plugins =
jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
def pluginMap=[:]
def installBuffer=new StringBuffer()
def url= jenkins.model.Jenkins.instance.getRootUrl()
plugins.each {
println "${it.getShortName()} \n\tversion ${it.getVersion()}
\n\t${it.getLongName()}"
pluginMap["${it.getShortName()}"]="${it.getLongName()}-${it.getVersion()}"
}
pluginMap.sort().each{key,value->
// println "$key \n\t $value"
installBuffer.append(key)
installBuffer.append(' ')
}
println "java -jar jenkins-cli.jar -s http://${destinationServer}:8080/
install-plugin ${installBuffer}"
On Friday, November 17, 2017 at 8:13:46 AM UTC-5, masaru tsuchiyama wrote:
>
> Hi
>
> Is there any way to save the information of the installed plugins
> as a text, and restore the plugins from the information.
>
> By saving jpi files, it is possible to save and restore the installed
> plugins.
>
> But I want to add the information to git repository.
> So the information should be a text file.
>
> Regards.
> Masaru.
>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/3d0bdc31-9144-4f14-8cd5-c025f22835aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.