]> git.apps.os.sepia.ceph.com Git - autobuild-ceph.git/commitdiff
build-auto: determine gitbuilder behavior from the hostname
authorSage Weil <sage@inktank.com>
Tue, 19 Feb 2013 05:09:50 +0000 (21:09 -0800)
committerSage Weil <sage@inktank.com>
Tue, 19 Feb 2013 05:09:50 +0000 (21:09 -0800)
Figure out what the build should do based on keywords in the
hostname.  Similarly, rsync to the remote target using the
fields in the hostname:

 gitbuilder-PROJECT-WHAT-DISTRO-ARCH-FLAVOR

 PROJECT is ceph, ...
 WHAT is deb or rpm (so far)
 DISTRO is precise, etc.
 ARCH is amd64, i386 (although the VM knows this anyway)
 FLAVOR is basic, notcmalloc, gcov, ...

This will simplify the fabfile a bit (at least for new builder VMs).  We
also solve the problem is passing the environment into the package build
from one central location (build-auto.sh) which has enough context/state in
the hostname to do the right thing.

Signed-off-by: Sage Weil <sage@inktank.com>
build-auto.sh [new file with mode: 0644]
fabfile.py

diff --git a/build-auto.sh b/build-auto.sh
new file mode 100644 (file)
index 0000000..3330eee
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh -x
+
+mydir=`dirname $0`
+
+if ! hostname | grep -q ^gitbuilder- ; then
+    echo "hostname "`hostname`"does not make sense to me; i fail"
+    exit 1
+fi
+
+if hostname | grep -q -- -notcmalloc- ; then
+    echo "hostname has -notcmalloc-, will build --without-tcmalloc"
+    export CEPH_EXTRA_CONFIGURE_ARGS+=" --without-tcmalloc"
+fi
+if hostname | grep -q -- -gcov- ; then
+    echo "hostname has -gcov-, will --enable-coverage"
+    export CEPH_EXTRA_CONFIGURE_ARGS+=" --enable-coverage"
+fi
+
+if hostname | grep -q -- -deb- ; then
+    exec $mydir/build-ceph-deb-native.sh
+fi
+if hostname | grep -q -- -rpm- ; then
+    exec $mydir/build-ceph-rpm.sh
+fi
+
+echo "i don't know what to do with hostname "`hostname`
+exit 1
+
index 9f519c8d124a4eefc1fb679ad9a8d063036b11dc..f2372366defddc416e4d5818d0d63c7833e47c13 100644 (file)
@@ -45,6 +45,10 @@ env.roledefs['gitbuilder_ceph_deb_native'] = [
     'ubuntu@gitbuilder-squeeze-deb-amd64.front.sepia.ceph.com',
     ]
 
+env.roledefs['gitbuilder_auto'] = [
+    'ubuntu@gitbuilder-ceph-deb-precise-amd64-notcmalloc.front.sepia.ceph.com',
+    ]
+
 #env.roledefs['gitbuilder_ceph_deb_ndn'] = [
 #    'ubuntu@10.3.14.65',
 #    ]
@@ -541,6 +545,12 @@ def gitbuilder_ceph_deb_native():
     sudo('start autobuild-ceph || /etc/init.d/autobuild-ceph start')
     _sync_to_gitbuilder('ceph', 'deb', 'basic')
 
+@roles('gitbuilder_auto')
+def gitbuilder_ceph_auto():
+    _deb_builder('https://github.com/ceph/ceph.git', 'auto')
+    sudo('start autobuild-ceph || /etc/init.d/autobuild-ceph start')
+    _sync_to_gitbuilder_from_hostname()
+
 @roles('gitbuilder_ceph_rpm')
 def gitbuilder_ceph_rpm():
     _gitbuilder_ceph_rpm('https://github.com/ceph/ceph.git', 'ceph-rpm')
@@ -630,16 +640,24 @@ def _sync_to_gitbuilder(package, format, flavor):
     with cd('/srv/autobuild-ceph'):
         # fugliness
         sudo("echo gitbuilder@gitbuilder.ceph.com:gitbuilder.ceph.com/%s-%s-`lsb_release -s -c`-`uname -m`-%s > rsync-target" % (package,format,flavor))
-        if not exists('rsync-key'):
-            if not os.path.exists('rsync-key'):
-                print >> sys.stderr, 'Required rsync keys to gitbuilder.ceph.com missing!'
-                sys.exit(1)
-            # for whatever reason, put doesn't seem to honor cd and use_sudo fails
-            put("rsync-key")
-            put("rsync-key.pub")
-            sudo("mv /home/ubuntu/rsync-key* ./")
-            sudo("chmod 600 rsync-key* ; chown autobuild-ceph.autobuild-ceph rsync-key*")
-
+        _sync_rsync_keys()
+
+def _sync_rsync_keys():
+    if not exists('rsync-key'):
+        if not os.path.exists('rsync-key'):
+            print >> sys.stderr, 'Required rsync keys to gitbuilder.ceph.com missing!'
+            sys.exit(1)
+        # for whatever reason, put doesn't seem to honor cd and use_sudo fails
+        put("rsync-key")
+        put("rsync-key.pub")
+        sudo("mv /home/ubuntu/rsync-key* ./")
+        sudo("chmod 600 rsync-key* ; chown autobuild-ceph.autobuild-ceph rsync-key*")
+
+def _sync_to_gitbuilder_from_hostname():
+    with cd('/srv/autobuild-ceph'):
+        # fugliness
+        sudo("echo gitbuilder@gitbuilder.ceph.com:gitbuilder.ceph.com/`hostname | cut --delimiter=- -f 2`-`hostname | cut --delimiter=- -f 3`-`lsb_release -s -c`-`uname -m`-`hostname | cut --delimiter=- -f 6` > rsync-target")
+        _sync_rsync_keys()
 
 #
 # build ndn debs for dho