]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
liveboot_build.sh: Replace pbuilder by schroot.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 11 Aug 2014 14:40:23 +0000 (16:40 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 11 Aug 2014 14:40:23 +0000 (16:40 +0200)
liveboot_build.sh

index 02bc3b2f607b5bc1d85fdcf405e07c572a4b4db6..6b0c16a82c63230e56ee8d709391ba7d56a26ff2 100755 (executable)
@@ -7,13 +7,7 @@ set_failure() {
        BUILD_END=$(date +%s)
        $SCRIPTSDIR/liveboot2db.py $JOB_NAME $BUILD_NUMBER $REQUEST_ID $BUILD_START $BUILD_END "failed"
     build_name=$(basename $(readlink -f /srv/build/liveboot/builds/last))
-       # cleanup mount points
-       cd /var/cache/pbuilder/build
        echo "My PID: $$"
-       sudo umount -l $$/proc || true
-       sudo umount -l $$/dev || true
-       sudo umount -l $$/dev/pts || true
-       sudo umount -l $$/srv/build || true
         exit 1
 }
 
@@ -28,12 +22,13 @@ fi
 #
 # Define default settings
 #
-export DIST=squeeze
-export PB_SUITE=production-proposed-updates
+DIST=squeeze
 
 SCRIPTSDIR=$(dirname $0)
 BUILD_SCRIPT=$(mktemp -t ${0##*/}.XXXXXXXXXX)
 cat > $BUILD_SCRIPT <<-EOF
+#!/bin/sh
+set -ex
 cd /srv/build
 rm liveboot -rf
 git clone git://git/ri/liveboot.git
@@ -42,6 +37,7 @@ git checkout $GIT_BRANCH
 [ -d /srv/build/cache ] && mv /srv/build/cache .
 ./build.sh $JOB_NAME $BUILD_NUMBER $GIT_BRANCH $REQUEST_ID
 EOF
+chmod +x $BUILD_SCRIPT
 
 #
 # add liveboot build to cidb
@@ -57,11 +53,9 @@ trap set_failure INT TERM EXIT ERR KILL STOP HUP ABRT PIPE CHLD
 
 #
 # build liveboot
-# (sudo is called from within a(nother) script as it's not possible to trap sudo directly
 # 
-echo "sudo pbuilder --execute --bindmounts /srv/build/ -- $BUILD_SCRIPT" > ${BUILD_SCRIPT}_sudo
-bash -x ${BUILD_SCRIPT}_sudo
-rm $BUILD_SCRIPT ${BUILD_SCRIPT}_sudo
+schroot -c liveboot-$DIST -u root -d /srv/build -- $BUILD_SCRIPT
+rm $BUILD_SCRIPT
 
 #
 # add liveboot build result to cidb