Upgrading Jenkins war file the quick and dirty way
By Iain Cuthbertson
jenkins-update.sh
:
#!/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
Comments
Matthew Morton says: 27th October 2017 at 10:24 pm
That IS really dirty…..but I like it!!!