Command Line Jenkins Update Site & Plugins

Re-Enable MD5 for Jenkins Update Site

With the current implementation of Jenkins Update Site, everything is signed with an MD5 certificate.  In order for Jenkins to load any updates from the site, MD5 must be re-enabled if it is currently disabled.  Below is a simple command for re-enabling your MD5.  Please note this is with OpenJDK 1.8.0.71  you will need to modify this line if your using a different version.

 sed -i -e 's/jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024/jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024/' /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64/jre/lib/security/java.security

Loading the update site via script

Sometimes you may want to update your Jenkins server, with the latest from the update site.  A couple of simple scripting lines and you have.

wget -O default.js http://updates.jenkins-ci.org/update-center.json
sed '1d;$d' default.js > default.json
mkdir /var/lib/jenkins/updates
mv default.json /var/lib/jenkins/updates/
chown -R jenkins:jenkins /var/lib/jenkins/updates

Installing Plugins from Command Line

If you need to install plugins from the Command Line it’s easy.  Use the Jenkins Command Line interface.  This example shows installing the Team Concert, Exclusive Execution, and Build User Vars Plugins.

curl -O http://localhost:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar -s http://localhost:8080/ install-plugin exclusive-execution --username <Insert Your Username here> --password <Insert Your Password>

Updating Existing Plugins from the Command Line

Updating currently installed plugins is just as simple as installing new ones.  Once again use the Jenkins Command Line Interface. Take note this will update ALL plugins.

curl -O http://localhost:8080/jnlpJars/jenkins-cli.jar
UPDATE_LIST=$( java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins | grep -e ')$' | awk '{ print $1 }' ); 
if [ ! -z "${UPDATE_LIST}" ]; then 
    echo Updating Jenkins Plugins: ${UPDATE_LIST}; 
    java -jar jenkins-cli.jar -s http://localhost:8080/ install-plugin ${UPDATE_LIST} --username <Insert Your Username here> --password <Insert Your Password>;
fi
  • Ghostprogrammer
  • I am known for being able to quickly decipher difficult problems to assist development teams in producing a solution. I have been called upon to be the Team Lead for multiple large-scale projects. I have a keen interest in learning new technologies, always ready for a new challenge.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: