Update all plugins automatically

23 views
Skip to first unread message

gotvi...@gmail.com

unread,
Oct 17, 2018, 5:18:26 PM10/17/18
to Jenkins Users
Hi,

We are using open source Jenkins and have a bunch of plugins installed.  Is there a way to update all the plugins that are in the "Updates" section in the Plugin Manager?

Simon Richter

unread,
Oct 18, 2018, 9:52:26 AM10/18/18
to jenkins...@googlegroups.com
Yes, if you select the checkboxes, you can update multiple plugins at
once. The "All" link at the bottom selects all checkboxes.

Simon

Slide

unread,
Oct 18, 2018, 10:16:48 AM10/18/18
to jenkins...@googlegroups.com
Another option would be Jenkins Evergreen [1]. It may meet your needs if you are looking for known working, updated plugins and Jenkins setups.


--
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/20181018135212.GA17055%40psi5.com.
For more options, visit https://groups.google.com/d/optout.

gotvi...@gmail.com

unread,
Oct 18, 2018, 3:34:19 PM10/18/18
to Jenkins Users
I can't believe how dumb I became!!! 

Thanks for the info :-)

gotvi...@gmail.com

unread,
Oct 18, 2018, 3:57:15 PM10/18/18
to Jenkins Users
My Jenkins is not a docker setup.  Can I still use this?  I found a plugin and installed it.  But getting this error


HTTP ERROR 404

Problem accessing /evergreen/. Reason:

    Not Found


Benjamin Brummer

unread,
Oct 18, 2018, 4:10:53 PM10/18/18
to Jenkins Users
You could setup a job which runs periodically on jenkins master.

Solution 1 ssh

# prepare info file
INFO_FILE=plugins.update.info
# CleanUp
rm -f *
touch $INFO_FILE
# get current version of cli JAR
wget http://127.0.0.1:8080/jnlpJars/jenkins-cli.jar
# update plugins
java -jar jenkins-cli.jar -ssh -user automationuser -i ~/.ssh/automationuser/id_rsa list-plugins | grep ')$' >> ./report_raw || true
# format report-file
cat ./report_raw | sed s/'  '/'\t'/g >> ./report
# prepare update list
UPDATE_LIST=$( java -jar jenkins-cli.jar -ssh -user username -i
~/path/to/id_rsa list-plugins | grep ')$' | cut -f 1 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' );
# update and create report
echo $UPDATE_LIST
if [ ! -z "${UPDATE_LIST}" ]; then
    java -jar jenkins-cli.jar -ssh -user username -i ~/path/to/id_rsa install-plugin ${UPDATE_LIST};
    java -jar jenkins-cli.jar -ssh -user username -i ~/path/to/id_rsa safe-restart;
    echo '<h2>Jenkins Plug-ins Update Report</h2>' >> $INFO_FILE
    echo 'The following plug-in updates have been conducted:' >> $INFO_FILE
    echo '<table>' >> $INFO_FILE
    echo '<tr><th align='left' style='padding-right:20px'>Plug-in ID</th><th align='left' style='padding-right:20px'>Plug-in name</th><th align='left' style='padding-right:20px'>Old Version</th><th align='left' style='padding-right:20px'>New Version</th><tr>' >> $INFO_FILE
    awk 'BEGIN { FS = "[()\t]+" } ;{print "<tr><td  align='left' style='padding-right:20px'>"$1"</td><td  align='left' style='padding-right:20px'>"$2"</td><td align='left' style='padding-right:20px'>"$3"</td><td align='left' style='padding-right:20px'>"$4"</td></tr>"}' report >> $INFO_FILE
    echo '</table>' >> $INFO_FILE
else   
    echo '<h2>Jenkins Plug-ins Update Report</h2>' >> $INFO_FILE
    echo '<p><b>No updates</b> for installed plug-ins were available!</p>' >> $INFO_FILE
fi
Solution 2 token
# prepare info file
INFO_FILE=plugins.update.info
rm -f $INFO_FILE
# get current version of cli JAR
rm -f jenkins-cli.jar
wget http://127.0.0.1:8080/jnlpJars/jenkins-cli.jar
# update plugins
rm -f ./tmp
rm -f ./tmp2
java -jar jenkins-cli.jar -auth username:token -s http://127.0.0.1:8080/ list-plugins | grep ')$' >> ./tmp | cat ./tmp | sed s/'  '/'\t'/g >> ./tmp2
UPDATE_LIST=$( java -jar jenkins-cli.jar -auth username:token -s http://127.0.0.1:8080/ list-plugins | grep ')$' | cut -f 1 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' );
if [ ! -z "${UPDATE_LIST}" ]; then
    java -jar jenkins-cli.jar -auth username:token -s http://127.0.0.1:8080/ install-plugin ${UPDATE_LIST};
    java -jar jenkins-cli.jar -auth username:token -s http://127.0.0.1:8080/ safe-restart;
    echo '<h2>Jenkins Plug-ins Update Report</h2>' >> $INFO_FILE
    echo 'The following plug-in updates have been conducted:' >> $INFO_FILE
    echo '<table>' >> $INFO_FILE
    echo '<tr><th align=\"left\" style=\"padding-right:20px\">Plug-in ID</th><th align=\"left\" style=\"padding-right:20px\">Plug-in name</th><th align=\"left\" style=\"padding-right:20px\">Old Version</th><th align=\"left\" style=\"padding-right:20px\">New Version</th><tr>' >> $INFO_FILE
    awk 'BEGIN { FS = "[()\t]+" } ;{print "<tr><td  align=\"left\" style=\"padding-right:20px\">"$1"</td><td  align=\"left\" style=\"padding-right:20px\">"$2"</td><td align=\"left\" style=\"padding-right:20px\">"$3"</td><td align=\"left\" style=\"padding-right:20px\">"$4"</td></tr>"}' tmp2 >> $INFO_FILE
    echo '</table>' >> $INFO_FILE
else
    echo '<h2>Jenkins Plug-ins Update Report</h2>' >> $INFO_FILE
    echo '<p><b>No updates</b> for installed plug-ins were available!</p>'>> $INFO_FILE
fi


R. Tyler Croy

unread,
Oct 19, 2018, 11:23:12 AM10/19/18
to jenkins...@googlegroups.com
(replies inline)

On Thu, 18 Oct 2018, gotvi...@gmail.com wrote:

> My Jenkins is not a docker setup. Can I still use this? I found a plugin
> and installed it. But getting this error

The Evergreen plugin is not useful when installed in a non-Jenkins Evergreen
instance. That plugin only exists to support the system bundled in those
Jenkins Evergreen containers.


--
GitHub: https://github.com/rtyler
Twitter: https://twitter.com/agentdero
signature.asc

Baptiste Mathus

unread,
Oct 19, 2018, 11:49:50 AM10/19/18
to jenkins...@googlegroups.com
There is a message that makes it clear it was not supposed to be installed on non-evergreen instances, but for some reason, it's removed 
Filed https://issues.jenkins-ci.org/browse/JENKINS-54167 to fix it and make it clearer for users this plugin must not be installed by anyone manually.

--
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.
Reply all
Reply to author
Forward
0 new messages