X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lbuild-nightly.sh;h=fd7809a53474d5f93c224adb9a2733413adf6a4c;hb=05af19c19a4e34f39b765aaa3502bc8d99aa79e1;hp=bc6c81fa313a63b932c2538dc8cd39aed4685d16;hpb=a66450ec6b7b4c266c8994db6cf297a9d115c5db;p=build.git diff --git a/lbuild-nightly.sh b/lbuild-nightly.sh index bc6c81fa..fd7809a5 100755 --- a/lbuild-nightly.sh +++ b/lbuild-nightly.sh @@ -52,6 +52,20 @@ function logfile () { echo /vservers/$slice.log.txt } +######################################## +# workaround for broken lxc-enter-namespace +# 1st version was relying on virsh net-dhcp-leases +# however this was too fragile, would not work for fedora14 containers +# WARNING: this code is duplicated in lbuild-initvm.sh +function guest_ipv4() { + lxc=$1; shift + + mac=$(virsh -c lxc:/// domiflist $lxc | egrep 'network|bridge' | awk '{print $5;}') + # sanity check + [ -z "$mac" ] && return 0 + arp -en | grep "$mac" | awk '{print $1;}' +} + # wrap a quick summary of suspicious stuff # this is to focus on installation that go wrong # use with care, a *lot* of other things can go bad as well @@ -231,6 +245,12 @@ function in_root_context () { rpm -q libvirt > /dev/null } +# convenient for simple commands +function run_in_build_guest () { + buildname=$1; shift + ssh -o "StrictHostKeyChecking no" root@$(guest_ipv4 $buildname) "$@" +} + # run in the vm - do not manage success/failure, will be done from the root ctx function build () { set -x @@ -305,7 +325,7 @@ function run_log () { ssh -n ${testmaster_ssh} rm -rf ${testdir} ${testdir}.git # check it out in the build - virsh -c lxc:/// lxc-enter-namespace --noseclabel $BASE /bin/bash -c "make -C /build tests-module ${MAKEVARS[@]}" + run_in_build_guest $BASE make -C /build tests-module ${MAKEVARS[@]} # push it onto the testmaster - just the 'system' subdir is enough rsync --verbose --archive $(rootdir $BASE)/build/MODULES/tests/system/ ${testmaster_ssh}:${BASE} @@ -644,17 +664,17 @@ function main () { # start in case e.g. we just rebooted virsh -c lxc:/// start ${BASE} || : # retrieve environment from the previous run - FCDISTRO=$(virsh -c lxc:/// lxc-enter-namespace --noseclabel ${BASE} /build/getdistroname.sh) - BUILD_SCM_URL=$(virsh -c lxc:/// lxc-enter-namespace --noseclabel ${BASE} /bin/bash -c "make --no-print-directory -C /build stage1=skip +build-GITPATH") + FCDISTRO=$(run_in_build_guest $BASE /build/getdistroname.sh) + BUILD_SCM_URL=$(run_in_build_guest $BASE make --no-print-directory -C /build stage1=skip +build-GITPATH) # for efficiency, crop everything in one make run tmp=/tmp/${BASE}-env.sh - virsh -c lxc:/// lxc-enter-namespace --noseclabel ${BASE} /bin/bash -c "make --no-print-directory -C /build stage1=skip \ - ++PLDISTRO ++PLDISTROTAGS ++PERSONALITY ++MAILDEST ++WEBPATH ++TESTBUILDURL ++WEBROOT" > $tmp + run_in_build_guest $BASE make --no-print-directory -C /build stage1=skip \ + ++PLDISTRO ++PLDISTROTAGS ++PERSONALITY ++MAILDEST ++WEBPATH ++TESTBUILDURL ++WEBROOT > $tmp . $tmp rm -f $tmp # update build [ -n "$SSH_KEY" ] && setupssh ${BASE} ${SSH_KEY} - virsh -c lxc:/// lxc-enter-namespace --noseclabel $BASE /bin/bash -c "cd /build; git pull; make tests-clean" + run_in_build_guest $BASE "(cd /build; git pull; make tests-clean)" # make sure we refresh the tests place in case it has changed rm -f /build/MODULES/tests options=(${options[@]} -d $PLDISTRO -t $PLDISTROTAGS -s $BUILD_SCM_URL) @@ -704,7 +724,7 @@ function main () { rm -rf $tmpdir # Extract build again - in the vm [ -n "$SSH_KEY" ] && setupssh ${BASE} ${SSH_KEY} - virsh -c lxc:/// lxc-enter-namespace --noseclabel $BASE /bin/bash -c "git clone $GIT_REPO /build; cd /build; git checkout $GIT_TAG" + run_in_build_guest $BASE "(git clone $GIT_REPO /build; cd /build; git checkout $GIT_TAG)" fi echo "XXXXXXXXXX $COMMAND: preparation of vm $BASE done" $(date) @@ -736,8 +756,8 @@ function main () { cp $COMMANDPATH $(rootdir ${BASE})/build/ # invoke this command in the vm for building (-T) - virsh -c lxc:/// lxc-enter-namespace --noseclabel ${BASE} /bin/bash -c "chmod +x /build/$COMMAND" - virsh -c lxc:/// lxc-enter-namespace --noseclabel ${BASE} /build/$COMMAND "${options[@]}" -b "${BASE}" "${MAKEVARS[@]}" "${MAKETARGETS[@]}" + run_in_build_guest $BASE chmod +x /build/$COMMAND + run_in_build_guest $BASE /build/$COMMAND "${options[@]}" -b "${BASE}" "${MAKEVARS[@]}" "${MAKETARGETS[@]}" fi # publish to the web so run_log can find them @@ -752,7 +772,7 @@ function main () { else # run scanpackages so we can use apt-get on this # (not needed on fedora b/c this is done by the regular build already) - virsh -c lxc:/// lxc-enter-namespace --noseclabel $BASE /bin/bash -c "(cd /build ; dpkg-scanpackages DEBIAN/ | gzip -9c > Packages.gz)" + run_in_build_guest $BASE "(cd /build ; dpkg-scanpackages DEBIAN/ | gzip -9c > Packages.gz)" webpublish mkdir -p $WEBPATH/$BASE/DEBIAN webpublish_rsync_files $WEBPATH/$BASE/DEBIAN/ $(rootdir $BASE)/build/DEBIAN/*.deb webpublish_rsync_files $WEBPATH/$BASE/ $(rootdir $BASE)/build/Packages.gz