Upgrading Jenkins war file the quick and dirty way

#!/bin/bash

set -e

if [ $# -eq 0 ]; then
    echo "New Jenkins version number missing"
    exit 1
fi

VERSION=${1}

set -x

cd /usr/share/jenkins/
wget http://updates.jenkins-ci.org/download/war/${VERSION}/jenkins.war -O jenkins.war-${VERSION}
rm jenkins.war && ln -s jenkins.war-${VERSION} jenkins.war
service jenkins restart

The above bash script will download a given version of the jenkins.war file and symlink it into place before restarting the jenkins service.

Assumptions made:

  • The jenkins.war file is installed to /usr/share/jenkins
  • The server is using upstart for running services
  • User input is sane – there is no validation or sanitisation

One thought on “Upgrading Jenkins war file the quick and dirty way”

Leave a Reply

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.