X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vbuild-nightly.sh;h=74f8c7b0b248ffb262c6b655a73da2bae685b386;hb=6b1546325f7749677d3870681e68001d73afd69d;hp=2643b6562f66ee434107b879e83139e7ddc7dda0;hpb=d083edaa483f3fcdc5224cda30e08e5db67dbb9b;p=build.git diff --git a/vbuild-nightly.sh b/vbuild-nightly.sh index 2643b656..74f8c7b0 100755 --- a/vbuild-nightly.sh +++ b/vbuild-nightly.sh @@ -10,10 +10,9 @@ DEFAULT_PLDISTRO=planetlab DEFAULT_BASE="@DATE@--@PLDISTRO@-@FCDISTRO@" DEFAULT_SVNPATH="http://svn.planet-lab.org/svn/build/trunk" -DEFAULT_MAILTO_onelab="onelab-build@one-lab.org" -# tmp - send all mails to onelab -#DEFAULT_MAILTO_planetlab="devel@planet-lab.org" -DEFAULT_MAILTO_planetlab=$DEFAULT_MAILTO_onelab +# NOTE: do not think we want to put email addresses into scripts +# that can be harvested by spambots. --mef +DEFAULT_MAILTO="onelab-build@one-lab.org" # web publishing results DEFAULT_WEBPATH="/build/@PLDISTRO@/" @@ -22,30 +21,45 @@ DEFAULT_WEBPATH="/build/@PLDISTRO@/" TESTBUILDURL="http://build.one-lab.org/" TESTBOX=onelab-test.inria.fr TESTBOXSSH=root@onelab-test.inria.fr -TESTSVNPATH="http://svn.one-lab.org/new_plc_api/trunk/plctest" +TESTSVNPATH="http://svn.planet-lab.org/svn/tests/trunk/system/" TESTSCRIPT=TestMain.py #################### # assuming vserver runs in UTC -DATE=$(date -u +'%Y.%m.%d') +DATE=$(date +'%Y.%m.%d') + +# temporary - 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 +function summary () { + from=$1; shift + echo "******************** BEG SUMMARY" + tr -d '\r' < $from | egrep 'BEG RPM|not installed|Installing:.*([eE]rror|[wW]arning)' + echo "******************** END SUMMARY" +} + # Notify recipient of failure or success, manage various stamps function failure() { set -x + WEBLOG=${WEBPATH}/${BASE}.log.txt + cp $LOG ${WEBLOG} + summary $LOG >> ${WEBLOG} + (echo -n "============================== $COMMAND: failure at " ; date ; tail -c 20k $WEBLOG) > ${WEBLOG}.ko if [ -n "$MAILTO" ] ; then - tail -c 8k $LOG | mail -s "Failures for build ${BASE}" $MAILTO + tail -c 20k ${WEBPATH}/${BASE}.log.txt | mail -s "Failures for build ${BASE}" $MAILTO fi - cp $LOG ${WEBPATH}/${BASE}.log.txt - (echo -n "============================== $COMMAND: failure at" ; date ; tail -c 20k $LOG) > ${WEBPATH}/${BASE}.bko.txt exit 1 } function success () { set -x + WEBLOG=${WEBPATH}/${BASE}.log.txt + cp $LOG ${WEBLOG} + summary $LOG >> ${WEBLOG} + touch ${WEBLOG}.ok if [ -n "$MAILTO" ] ; then - (echo "http://build.one-lab.org/$PLDISTRO/$BASE" ; echo "Completed on $(date)" ) | mail -s "Successfull build for ${BASE}" $MAILTO + (echo "$PLDISTRO ($BASE) build for $FCDISTRO completed on $(date)" ) | mail -s "Successfull build for ${BASE}" $MAILTO fi - cp $LOG ${WEBPATH}/${BASE}.log.txt - touch ${WEBPATH}/${BASE}.bok.txt exit 0 } @@ -98,18 +112,22 @@ function runtest () { fi url=${TESTBUILDURL}${PLDISTRO}/${BASE}/RPMS/i386/${rpm} - # find the place where the plctest material was checked out - cd /vservers/$BASE/build/CODEBASES/PLCAPI - if [ ! -d plctest/ ] ; then - echo "$COMMAND : Cannot not locate plctest/ - exiting" - failure + # checkout the system test (formerly known as plctest) + cd /vservers/${BASE}/build + rm -rf TESTS + svn export $TESTSVNPATH TESTS + # dont trust retcod + if [ ! -d TESTS ] ; then + echo "$COMMAND: could not svn export $SVNPATH - check url" exit 1 fi + # compute test directory name on test box testdir=plctest-${BASE} - # rsync/push test material onto the test box + # rsync/push test material onto the test box - clean first + ssh ${TESTBOXSSH} rm -rf ${testdir} ssh ${TESTBOXSSH} mkdir -p ${testdir} - rsync -a -v plctest/ ${TESTBOXSSH}:${testdir} + rsync -a -v TESTS/ ${TESTBOXSSH}:${testdir}/ # invoke test on testbox ssh ${TESTBOXSSH} python -u ${testdir}/${TESTSCRIPT} ${url} #invoke make install from build to the testbox @@ -212,11 +230,12 @@ function main () { [ -z "$BASE" ] && BASE="$DEFAULT_BASE" [ -z "$WEBPATH" ] && WEBPATH="$DEFAULT_WEBPATH" [ -z "$SVNPATH" ] && SVNPATH="$DEFAULT_SVNPATH" - # + + # NOTE: suggest that by default no email is sent and that the user + # should explicitly invoke this script with the -m arg to pass in + # the appropriate email address. --mef if [ "$PLDISTRO" = "onelab" ] ; then - [ -z "$MAILTO" ] && MAILTO="$DEFAULT_MAILTO_onelab" - else - [ -z "$MAILTO" ] && MAILTO="$DEFAULT_MAILTO_planetlab" + [ -z "$MAILTO" ] && MAILTO="$DEFAULT_MAILTO" fi [ -n "$DRY_RUN" ] && MAILTO="" @@ -283,17 +302,17 @@ function main () { ./vbuild-init-vserver.sh ${BASE} ${FCDISTRO} ${PLDISTRO} # cleanup cd - - rm -f $tmpdir + rm -rf $tmpdir # Extract build again - in the vserver - vserver ${BASE} exec svn export ${SVNPATH} /build + vserver ${BASE} exec svn checkout ${SVNPATH} /build fi echo "XXXXXXXXXX $COMMAND: preparation of vserver $BASE done" $(date) # The log inside the vserver contains everything LOG2=/vservers/${BASE}/log.txt - (echo "==================== Transcript of vserver creation -- BEG $(date)" ; \ + (echo "==================== BEG VSERVER Transcript of vserver creation" ; \ cat $LOG ; \ - echo "==================== Transcript of vserver creation -- END $(date)" ; \ + echo "==================== END VSERVER Transcript of vserver creation" ; \ echo "xxxxxxxxxx Messing with logs, symlinking $LOG2 to $LOG" ) >> $LOG2 ### not too nice : nuke the former log, symlink it to the new one rm $LOG; ln -s $LOG2 $LOG @@ -306,6 +325,7 @@ function main () { cp $COMMANDPATH /vservers/${BASE}/build/ # invoke this command in the vserver for building (-T) + vserver ${BASE} exec chmod +x /build/$COMMAND vserver ${BASE} exec /build/$COMMAND "${argv[@]}" -b "${BASE}" fi