Save the installed plugins as a text

24 views
Skip to first unread message

Masaru Tsuchiyama

unread,
Nov 17, 2017, 8:13:46 AM11/17/17
to jenkins...@googlegroups.com
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.

Victor Martinez

unread,
Nov 17, 2017, 8:32:21 AM11/17/17
to Jenkins Users

 There are different approaches already explained in the Stacktrace:
Regarding the second question, I'd rather suggest to use any Configuration management tools, such as Puppet, Chef, Ansible... or Docker, there are plenty of examples about it, look at the docker one:

Victor Martinez

unread,
Nov 17, 2017, 8:33:00 AM11/17/17
to Jenkins Users
Stackoverflow ^^____ ( I typed too fast )

Ioannis Moutsatsos

unread,
Nov 17, 2017, 8:55:22 AM11/17/17
to Jenkins Users
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}"

masaru tsuchiyama

unread,
Nov 21, 2017, 7:49:40 AM11/21/17
to jenkins...@googlegroups.com
Hi

Thank you for the answers.

Regards.
Masaru


2017-11-17 22:33 GMT+09:00 Victor Martinez <victormar...@gmail.com>:
Stackoverflow ^^____ ( I typed too fast )

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a2c76be2-7ed3-4e56-b2fe-6bf264d3fd91%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages