Move the buildbot workdirs to a non-volatile directory
authorDan Scott <dan@coffeecode.net>
Wed, 25 May 2011 04:02:33 +0000 (00:02 -0400)
committerDan Scott <dan@coffeecode.net>
Wed, 25 May 2011 04:02:33 +0000 (00:02 -0400)
/tmp/ is a good directory for throwing temporary things,
but not so good for things you want to keep around for a relatively
long time. Especially on Ubuntu, which has a default policy of
deleting files in /tmp/ on reboot - meaning that the git repos
that form the basis of the repository have all of their files
wiped - greatly confusing the buildbot, which tries to run
'git reset --head' in an empty directory and fails miserably
in that situation.

So - ensure that WORKDIR is set to something that exists and
which will exist for the duration of your CI server, and you'll
be all right.

Signed-off-by: Dan Scott <dan@coffeecode.net>

examples/buildbot.cfg
src/perl/lib/OpenSRF/Utils/Cache.pm

index d2d74c3..c2a980c 100644 (file)
@@ -8,6 +8,11 @@
 # a shorter alias to save typing.
 c = BuildmasterConfig = {}
 
+# WORKDIR must be an absolute path that is not volatile; systems
+# like Ubuntu wipe /tmp/ on a reboot, for example, which is
+# disastrous for build history, at least for gitpoller
+WORKDIR = '/home/buildmaster/'
+
 ####### BUILDSLAVES
 
 # The 'slaves' list defines the set of recognized buildslaves. Each element is
@@ -50,7 +55,7 @@ for osrf_branch in OSRF_BRANCHES:
     c['change_source'].append(gitpoller.GitPoller(
         project='OpenSRF',
         repourl=osrf_git,
-        workdir='/tmp/buildbot_osrf_' + osrf_branch,
+        workdir= WORKDIR + 'buildbot_osrf_' + osrf_branch,
         branch=osrf_branch
     ))
 
@@ -58,7 +63,7 @@ for eg_branch in EG_BRANCHES:
     c['change_source'].append(gitpoller.GitPoller(
         project='Evergreen',
         repourl=eg_git,
-        workdir='/tmp/buildbot_eg_' + eg_branch,
+        workdir= WORKDIR + 'buildbot_eg_' + eg_branch,
         branch=eg_branch
     ))
 
index 1fb56a4..b7344d2 100644 (file)
@@ -94,6 +94,9 @@ sub new {
        $self->{persist} = $persist || 0;
        $self->{memcache} = Cache::Memcached->new( { servers => $servers } ); 
        if(!$self->{memcache}) {
+        open(CACHEFOO, '>', '/tmp/cached');
+        print CACHEFOO "De nada\n";
+        close(CACHEFOO);
                throw OpenSRF::EX::PANIC ("Unable to create a new memcache object for $cache_type");
        }