Docker: Mention how to generate a plugins.txt from an existing jenkins instance

Created on 28 Aug 2016  ·  7Comments  ·  Source: jenkinsci/docker

Hi thanks for the official image on https://hub.docker.com/_/jenkins/. Since users are likely to be switching to a docker deployment from an existing jenkins system, please mention how to generate the plugins.txt to copy to /usr/share/jenkins/ref/.

This url allows you can see all the plugins and versions installed on an existing instance:
http://JENKINS:8080/systemInfo
It might be easier to turn the xml into a plugins.txt:
http://JENKINS:8080/pluginManager/api/xml?depth=1&xpath=/_/_/shortName|/_/_/version&wrapper=plugins

Also nice to include the "jobs" directory in the example for pre-configuring the new instance.

ADD jobs /usr/share/jenkins/ref/

Most helpful comment

The link provided by @jamshid does not seem to work on our Jenkins (v2.73.1), I use the following .groovy script

Jenkins.instance.pluginManager.plugins.each{
  plugin -> 
    println ("${plugin.getShortName()}: ${plugin.getVersion()}")
}

This can be executed from the "Script" console at https://YOUR_JENKINS_URL/script (assuming you are admin)

All 7 comments

isn't this already covered in https://github.com/jenkinsci/docker#preinstalling-plugins ?

Ah thanks, yes it is, can that curl be copied to the hub.docker.com instructions or linked?
It seems the hub instructions refer to https://github.com/docker-library/ a lot maybe it should link to https://github.com/jenkinsci/docker if that's where the more complete / up to date instructions are?

The link provided by @jamshid does not seem to work on our Jenkins (v2.73.1), I use the following .groovy script

Jenkins.instance.pluginManager.plugins.each{
  plugin -> 
    println ("${plugin.getShortName()}: ${plugin.getVersion()}")
}

This can be executed from the "Script" console at https://YOUR_JENKINS_URL/script (assuming you are admin)

@espenalb can you fix the sample, there is no space after :

${plugin.getShortName()}:${plugin.getVersion()}

@espenalb Thanks for the handy Groovy! For newer versions of Jenkins than 2.8x you will need to coerce the return to a specific type. https://stackoverflow.com/a/48198920/3794873

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arthurvanduynhoven picture arthurvanduynhoven  ·  3Comments

ThStock picture ThStock  ·  8Comments

matthijsvdr picture matthijsvdr  ·  4Comments

lfcgomes picture lfcgomes  ·  8Comments

fboudra picture fboudra  ·  4Comments