Administering Hudson

This page has been migrated to the Eclipse wiki. Please update your bookmarks accordingly.

HUDSON_HOME directory

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.

Moving/copying/renaming jobs

You can:

  1. move a job from one installation of Hudson to another by simply copying the corresponding job directory.
  2. make a copy of an existing job by making a clone of a job directory by a different name.
  3. 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.

Script Console

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.

URL Options

http://[hudson-server]/[command]

where [command] can be

  • exit shutdown hudson
  • restart restart hudson

Labels:

daemon daemon Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Feb 15, 2008

    Anonymous says:

    I am getting "Hudson detected that you appear to be running more tha...

    I am getting "Hudson detected that you appear to be running more than one
    instance of Hudson that share the same home directory '/home/java/.hudson'. This
    greatly confuses Hudson and you will likely experience strange behaviors, so
    please correct the situation." error occasionally.  I am using version 1.180.
    Is this an issue?  What am I doing wrong?

  2. May 20, 2008

    Li Yun says:

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the...

    How to hide the WorkSpace Link and picture link on the Web GUI, I don't want the source code can be download by anyone. Is there anyone know how to do that?

     liyun935cn@yahoo.com.cn

  3. Oct 08, 2008

    Lionel says:

    What path/partition is used to determine "free disk space" in Linux?  I'm c...

    What path/partition is used to determine "free disk space" in Linux?  I'm constantly getting:

    WARNING: Making  offline temporarily due to the lack of disk space

    When I look at /computer, it shows "Free Disk Space" to be 0.680 GB for master, but I have at least 30GB free in the user.dir and user.home directories (viewing with df). Free swap space looks fine.

  4. Dec 16, 2008

    Dominik Kapusta says:

    I have a backup-ing job that runs every hour and gathers only configuration xmls...

    I have a backup-ing job that runs every hour and gathers only configuration xmls that are needed to restore jobs.
    It is built periodically (every hour from 8:00AM till 6:00PM, Monday-Friday):
    0 8-18 * * 1-5

    It contains single "Execute shell" build step:

    export CUR_PATH=`pwd`
    cd $HUDSON_HOME
    find -maxdepth 3 -name config.xml|xargs tar cvf configs.tar
    mv configs.tar $CUR_PATH/configs.tar

    And  "Archive the artifacts" contains only "configs.tar", so we keep the history of jobs.
    You can even add some scp to push the tar forward to another server.

  5. Sep 19, 2009

    Stephane Heck says:

    Hi all, Does anyone know if it is possible to share the same build number betwe...

    Hi all,

    Does anyone know if it is possible to share the same build number between several jobs?

    I already tried a little hack but it did not work:

    I used symlinks so that job A and job B  points to the same nextBuildNumber file. But the hudson job process seems to delete the nextBuildNumber file and then create a new nextBuildNumber (so the symlinks were destroyed).

    Thanks, Stephane