|Hudson Continuous Integration Server|
|Mailing List • Forums • IRC • mattermost|
|Open • Help Wanted • Bug Day|
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 wget http://hudson.gotdns.com/latest/hudson.war nohup /usr/local/bin/copywar.sh > /tmp/copywar.out 2>&1 &
copywar.sh contains this:
\#\!/bin/bash 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
This update procedure works, if you installed Hudson from a Debian package (see http://weblogs.java.net/blog/kohsuke/archive/2008/06/debian_packages.html for more information):
aptitude update aptitude install hudson
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="http://hudson.gotdns.com/latest/hudson.war" REM === CVS Settings === set cvsLoc="C:\Program Files\CVSNT" set cvsRoot=":pserver:firstname.lastname@example.org:/location" 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"