Skip to main content
Jump to: navigation, search

Hudson-ci/Automated Upgrade

Hudson Continuous Integration Server
Mailing ListForumsIRCmattermost
OpenHelp WantedBug Day
Browse Source
Hudson-bust.png Automated Upgrades

Unix/Linux/Mac Auto-Upgrade With Container

If you run Hudson with java -jar hudson.war, Hudson will be able to update itself by itself. This is the simplest way to do automatic upgrades.

If you run Hudson in other servlet containers, here is a simple set of steps to create a Hudson job to semi-automate Hudson Updates written by Rolf. The local paths need to be changed to reflect the individual setup configuration.

cd /tmp
rm -f hudson.war.backup
cp /usr/local/jboss/server/default/deploy/hudson.war /tmp/hudson.war.backup
rm -f hudson.war
nohup /usr/local/bin/ > /tmp/copywar.out 2>&1 & contains this:

sleep 20
cp /tmp/hudson.war /usr/local/jboss/server/default/deploy

The reason this in in a separate script with a nohup is so that the job can complete properly before Hudson deployment begins.

Debian Package Upgrade

Verification Required
Is this still an issue?

Using the Upgrade-Button from within Hudson (available since Hudson 1.318) will not work if Hudson was installed from a Debian package (results in permission denied errors when trying to download the new WAR file)
This update procedure works, if you installed Hudson from a Debian package (see for more information): 
aptitude update
aptitude install hudson

Windows Auto-Upgrade

If you install Hudson as a Windows service, Hudson will be able to update itself by itself. This is the simplest way to do it.

Alternatively, here is a similar script to the one above for Windows users.  It is a batch file and can be setup as a scheduled task to update Hudson on a regular schedule.  This particular script keeps a backup of the most recent copy of Hudson.war in a separate backup dir and then commits that copy to cvs, if you do not want two copies or do not require CVS backups, you can simply remove that code.  It does delete the complete exploded war file from the deployment location, so be careful if you save any configuration files to that directory.

@echo off
REM === Some modifications need to be made for your setup options ===
set backupDir="C:\hudson-backups"
set deployLoc="C:\Deployment Location\webapps"
set hudsonURL=""
REM === CVS Settings ===
set cvsLoc="C:\Program Files\CVSNT"
set cvsRoot=""
set cvsPassword=yourPassword
REM === clean old files ===
cd %backupDir%
del hudson.war
del %deployLoc%\hudson.war
REM === make room to explode new war file ===
RD /s /q %deployLoc%\hudson
REM === get new files ===
C:\wget\wget.exe \-P %deployLoc% \--no-check-certificate %hudsonURL% copy
%deployLoc%\hudson.war %backupDir%\hudson.war"
REM === commit backup files to CVS ===
%cvsLoc%\cvs \-d %cvsRoot% login \-p %cvsPassword% %cvsLoc%\cvs \-d
%cvsRoot% commit \-m "Hudson Update"

Back to the top