How can I find the plugin name to use with install-plugins.sh?

769 views
Skip to first unread message

Thomas Sundberg

unread,
Sep 13, 2018, 7:42:43 AM9/13/18
to Jenkins Users
Hi!

I am creating a Jenkins installation from a Dockerfile. I want to
specify all plugins so they are available when the image is built.

This typically looks like many lines like this:

RUN /usr/local/bin/install-plugins.sh greenballs

Is there a way to find the proper name for each plugin? I am currently
looking for the proper name for the Docker Pipeline
Plugin,https://wiki.jenkins.io/display/JENKINS/Docker+Pipeline+Plugin

Cheers,
Thomas

--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback

Thomas Sundberg

unread,
Sep 13, 2018, 8:00:18 AM9/13/18
to Jenkins Users
Hi!

This is partly answering my own question:

Install the plugin you want to try.

Run the script

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

Locate the short name of the plugin you want to deploy and add it to
the Dockerfile.

In this particular case, look for the line

Docker Pipeline (docker-workflow): 1.17

and add

RUN /usr/local/bin/install-plugins.sh docker-workflow

in your Dockerfile.

Clumsy? Yes
Did it work? Yes

What would you like?
A section at the page
https://wiki.jenkins.io/display/JENKINS/Docker+Pipeline+Plugin stating
that the command line name for this plugin is docker-workflow

Cheers,
Thomas

Richard Bywater

unread,
Sep 14, 2018, 6:04:32 AM9/14/18
to jenkins...@googlegroups.com
Note that you can also find the ID of a plugin on the plugins.jenkins.io page for that plugin (e.g. https://plugins.jenkins.io/docker-workflow) - its ID is shown just below the plugin name header.

Richard.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CACpkv-x3VCcC8sWiDqMT%2BDUpPej09cZL7aKXQYQ20zjzENMoxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jan Monterrubio

unread,
Sep 14, 2018, 8:47:47 AM9/14/18
to jenkins...@googlegroups.com
If I recall correctly, install plugins can handle a pipe delimited list of plugin names and versions. Or maybe I’m confusing that script with a different one. 

Thomas Sundberg

unread,
Sep 17, 2018, 3:06:25 AM9/17/18
to Jenkins Users
Thank you Richard!

This was exactly what I needed but I had missed since it was rather
small and with grey text.

/Thomas
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAAy0hwek0EFfzzkZLzGtpLYd%2Bu1qk8h6KEwg_bTLvRjcP-Fc_A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



dave.bender

unread,
Oct 10, 2018, 5:43:17 PM10/10/18
to Jenkins Users
Is there an API call that could be used to retrieve that and other tidbits about the plugin?   We're looking for a way to effectively audit and automate our plugin management.  I suppose we could call that page and screen scrape the data, but I was wondering if the data displayed is already available somewhere.


Dave

Sven Hüßner

unread,
May 2, 2019, 3:18:56 PM5/2/19
to Jenkins Users
I realize this is something of a necro, but for future people coming by, this will help:

Use Jenkins-CLI to retrieve a list of plugins installed in the instance:

java -jar jenkins-cli.jar -s http://10.10.18.10:9000/ list-plugins

jdk-tool                           JDK Tool Plugin                                                  1.2
build-timeout                      Build Timeout                                                    1.19
resource-disposer                  Resource Disposer Plugin                                         0.12
jsch                               JSch dependency plugin                                           0.1.55
workflow-scm-step                  Pipeline: SCM Step                                               2.7
...

You can also get this via

$ JENKINS_HOST=username:pass...@myhost.com:port

$ curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/'


Example Output:


cucumber-testresult-plugin:0.8.2
pam-auth:1.1
matrix-project:1.4.1
script-security:1.13
...




Then you can use a file with the format of
<plugin-name>:<version>
<plugin-name>:<version>
<plugin-name>:<version>
....

And copy it over in your Dockerfile, then use it as input for install-plugins.sh

Dockerfile:
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt

It's quite a bit irritating though when you come to updating those plugins later on. And I haven't found a solution for it yet.
Reply all
Reply to author
Forward
0 new messages