Using Hudson/Administering Hudson
|Hudson Continuous Integration Server|
|Mailing List • Forums • IRC|
Hudson needs some diskspace to perform builds and keep archives. You can check this location from the configuration screen of Hudson.
By default, this is set to
~/.hudson, but you can change this in one of the following ways:
- Set "HUDSON_HOME" environment variable to the new home directory before launching the servlet container.
- Set "HUDSON_HOME" system property to the servlet container.
- Set JNDI environment entry "HUDSON_HOME" to the new directory.
See the container specific documentation collection for more about how to do this for your container.
You can change this location after you've used Hudson for a while, too. To do this, stop Hudson completely, move the contents from old HUDSON_HOME to the new home, set the new HUDSON_HOME, and restart Hudson.
HUDSON_HOME has a fairly obvious directory structure that looks like the following:
HUDSON_HOME +- config.xml (hudson root configuration) +- *.xml (other site-wide configuration files) +- userContent (files in this directory will be served under your http://server/hudson/userContent/) +- fingerprints (stores fingerprint records) +- plugins (stores plugins) +- jobs +- [JOBNAME] (sub directory for each job) +- config.xml (job configuration file) +- workspace (working directory for the version control system) +- latest (symbolic link to the last successful build) +- builds +- [BUILD_ID] (for each build) +- build.xml (build result summary) +- log (log file) +- changelog.xml (change log)
Back up and restore
All the settings, build logs, artifact archives are stored under the HUDSON_HOME directory. Simply archive this directory to make a back up. Similarly, restoring the data is just replacing the contents of the HUDSON_HOME directory from a back up.
Back ups can be taken without stopping the server, but when you restore, please do stop the server.
- move a job from one installation of Hudson to another by simply copying the corresponding job directory.
- make a copy of an existing job by making a clone of a job directory by a different name.
- rename an existing job by renaming a directory.
Those operations can be done even when Hudson is running. For changes like these to take effect, you have to click "reload config" to force Hudson to reload configuration from the disk.
Batch renaming jobs
Replacing spaces in job names with underscores:
$ rename 's/\s/_/g' *
Archive unused jobs
Sometimes you want to remove a job from Hudson but do so in such a way that you can resurrect it later, if the need arises. You can do this by going to $HUDSON_HOME and create an archive of the job directory. The following command illustrates how to archive a job 'xyz' and remove it:
$ cd $HUDSON_HOME/jobs $ tar czf xyz.tgz xyz // go to Hudson GUI "Manage Hudson" page and "Reload Configuration from Disk"
As long as you are not building the
xyz project while you create an archive, you can do this operation without taking Hudson offline.
Useful for trouble-shooting, diagnostics or batch updates of jobs Hudson provides a script console which gives you access to all Hudson internals. These scripts are written in Groovy and you'll find some samples of them in this page.
where \[command\] can be