X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vbuild-nightly.sh;h=245dd6f6ca216efd7e1a2690c6d4d820500fa29a;hb=5cb50be2d2f357bfa2beb579cc884afa07f13eba;hp=9c9d17061d9512f19800c3240be7ce398241ea71;hpb=a46eaa49b0ee83d7649d54028fbfdbeffe0c0044;p=build.git diff --git a/vbuild-nightly.sh b/vbuild-nightly.sh index 9c9d1706..245dd6f6 100755 --- a/vbuild-nightly.sh +++ b/vbuild-nightly.sh @@ -5,9 +5,9 @@ COMMANDPATH=$0 COMMAND=$(basename $0) # default values, tunable with command-line options -DEFAULT_FCDISTRO=centos5 +DEFAULT_FCDISTRO=f14 DEFAULT_PLDISTRO=planetlab -DEFAULT_PERSONALITY=linux32 +DEFAULT_PERSONALITY=linux64 DEFAULT_BASE="@DATE@--@PLDISTRO@-@FCDISTRO@-@PERSONALITY@" DEFAULT_BUILD_SCM_URL="git://git.onelab.eu/build" DEFAULT_IFNAME=eth0 @@ -113,18 +113,22 @@ EOF # utilities for handling the pushed material (rpms, logfiles, ...) function webpublish_misses_dir () { ssh root@${WEBHOST} "bash -c \"test \! -d $1\"" ; } function webpublish () { ssh root@${WEBHOST} "$@" ; } -function webpublish_rsync_dir () { rsync --archive --delete $VERBOSE $1 root@${WEBHOST}:$2 ; } -function webpublish_rsync_file () { rsync $VERBOSE $1 root@${WEBHOST}:$2 ; } function webpublish_cp_local_to_remote () { scp $1 root@${WEBHOST}:$2 ; } function webpublish_cp_stdin_to_file () { ssh root@${WEBHOST} cat \> $1; } function webpublish_append_stdin_to_file () { ssh root@${WEBHOST} cat \>\> $1; } +# provide remote dir as first argument, so any number of local files can be passed next +function webpublish_rsync_dir () { rsync --archive --delete $VERBOSE $2 root@${WEBHOST}:$1 ; } +function webpublish_rsync_files () { + remote="$1"; shift + rsync --archive $VERBOSE "$@" root@${WEBHOST}:"$remote" ; +} # Notify recipient of failure or success, manage various stamps function failure() { set -x # early stage ? - let's not create /build/@PLDISTRO@ if test -z "$WEBLOG" ; then - WEBHOST=localhost + WEBHOST=$(hostname) WEBPATH=/tmp WEBBASE=/tmp/vbuild-early-$(date +%Y-%m-%d) WEBLOG=/tmp/vbuild-early-$(date +%Y-%m-%d).log.txt @@ -139,9 +143,9 @@ function failure() { ( \ echo "Subject: KO ${BASE} ${MAIL_SUBJECT}" ; \ echo "To: $MAILTO" ; \ - echo "See full build log at $WEBBASE_URL/log.txt" ; \ - echo "and tail version at $WEBBASE_URL.ko" ; \ - echo "See complete set of testlogs at $WEBBASE_URL/testlogs" ; \ + echo "see build results at $WEBBASE_URL" ; \ + echo "including full build log at $WEBBASE_URL/log.txt" ; \ + echo "and complete test logs at $WEBBASE_URL/testlogs" ; \ echo "........................................" ; \ webpublish tail --lines=1000 $WEBLOG ) | \ sendmail $MAILTO @@ -153,7 +157,7 @@ function success () { set -x # early stage ? - let's not create /build/@PLDISTRO@ if test -z "$WEBLOG" ; then - WEBHOST=localhost + WEBHOST=$(hostname) WEBPATH=/tmp WEBLOG=/tmp/vbuild-early-$(date +%Y-%m-%d).log.txt fi @@ -161,26 +165,31 @@ function success () { webpublish_cp_local_to_remote $LOG $WEBLOG summary $LOG | webpublish_append_stdin_to_file $WEBLOG if [ -n "$DO_TEST" ] ; then + short_message="PASS" ( \ echo "Successfully built and tested" ; \ - echo "See full build log at $WEBBASE_URL/log.txt" ; \ - echo "See complete set of testlogs at $WEBBASE_URL/testlogs" ; \ + echo "see build results at $WEBBASE_URL" ; \ + echo "including full build log at $WEBBASE_URL/log.txt" ; \ + echo "and complete test logs at $WEBBASE_URL/testlogs" ; \ ) | webpublish_cp_stdin_to_file $WEBBASE.pass webpublish rm -f $WEBBASE.pkg-ok $WEBBASE.ko else + short_message="PKGOK" ( \ echo "Successful package-only build, no test requested" ; \ - echo "See full build log at $WEBBASE_URL/log.txt" ; \ + echo "see build results at $WEBBASE_URL" ; \ + echo "including full build log at $WEBBASE_URL/log.txt" ; \ ) | webpublish_cp_stdin_to_file $WEBBASE.pkg-ok webpublish rm -f $WEBBASE.ko fi if [ -n "$MAILTO" ] ; then ( \ - echo "Subject: PASS ${BASE} ${MAIL_SUBJECT}" ; \ + echo "Subject: $short_message ${BASE} ${MAIL_SUBJECT}" ; \ echo "To: $MAILTO" ; \ echo "$PLDISTRO ($BASE) build for $FCDISTRO completed on $(date)" ; \ - echo "See full build log at $WEBBASE_URL/log.txt" ; \ - [ -n "$DO_TEST" ] && echo "See complete set of testlogs at $WEBBASE_URL/testlogs" ) \ + echo "see build results at $WEBBASE_URL" ; \ + echo "including full build log at $WEBBASE_URL/log.txt" ; \ + [ -n "$DO_TEST" ] && echo "and complete test logs at $WEBBASE_URL/testlogs" ) \ | sendmail $MAILTO fi # XXX For some reason, we haven't been getting this email for successful builds. If this sleep @@ -287,7 +296,7 @@ function run_log () { rsync --verbose --archive ${testmaster_ssh}:$BASE/logs/ /vservers/$BASE/build/testlogs # push them to the build web chmod -R a+r /vservers/$BASE/build/testlogs/ - webpublish_rsync_dir /vservers/$BASE/build/testlogs/ $WEBPATH/$BASE/testlogs/ + webpublish_rsync_dir $WEBPATH/$BASE/testlogs/ /vservers/$BASE/build/testlogs/ echo "============================== END $COMMAND:run_log on $(date)" @@ -418,6 +427,7 @@ function usage () { echo " -y {pl,pg} - passed to run_log" echo " -e step - passed to run_log" echo " -X : passes --lxc to run_log" + echo " -S : passes --vs to run_log" echo " -x - a hook to pass other arguments to run_log" echo " -w webpath - defaults to $DEFAULT_WEBPATH" echo " -W testbuildurl - defaults to $DEFAULT_TESTBUILDURL; this is also used to get the hostname where to publish builds" @@ -453,7 +463,7 @@ function main () { SIGNYUMREPO="" OPTS_ORIG=$@ - OPTS=$(getopt -o "f:d:p:m:s:t:b:o:c:y:e:Xx:w:W:r:M:Yg:u:K:SBTnv7i:P:h" -l "build-branch:" -- $@) + OPTS=$(getopt -o "f:d:p:m:s:t:b:o:c:y:e:XSx:w:W:r:M:Yg:u:K:SBTnv7i:P:h" -l "build-branch:" -- $@) if [ $? != 0 ] then usage @@ -475,8 +485,10 @@ function main () { -y) RUN_LOG_EXTRAS="$RUN_LOG_EXTRAS --rspec-style $2"; shift 2 ;; # -e foo -> run_log -e foo -e) RUN_LOG_EXTRAS="$RUN_LOG_EXTRAS --exclude $2"; shift 2 ;; - # -X -> run_log -X + # -X -> run_log --lxc -X) RUN_LOG_EXTRAS="$RUN_LOG_EXTRAS --lxc"; shift;; + # -S -> run_log --vs + -S) RUN_LOG_EXTRAS="$RUN_LOG_EXTRAS --vs"; shift;; # more general form to pass args to run_log # -x foo -> run_log foo -x) RUN_LOG_EXTRAS="$RUN_LOG_EXTRAS $2"; shift 2;; @@ -705,12 +717,22 @@ function main () { # publish to the web so run_log can find them set +e webpublish rm -rf $WEBPATH/$BASE - webpublish mkdir -p $WEBPATH/$BASE/{RPMS,SRPMS} - webpublish_rsync_dir /vservers/$BASE/build/RPMS/ $WEBPATH/$BASE/RPMS/ - [[ -n "$PUBLISH_SRPMS" ]] && webpublish_rsync_dir /vservers/$BASE/build/SRPMS/ $WEBPATH/$BASE/SRPMS/ + # guess if we've been doing any debian-related build + if [ ! -f /vservers/$BASE/etc/debian_version ] ; then + webpublish mkdir -p $WEBPATH/$BASE/{RPMS,SRPMS} + webpublish_rsync_dir $WEBPATH/$BASE/RPMS/ /vservers/$BASE/build/RPMS/ + [[ -n "$PUBLISH_SRPMS" ]] && webpublish_rsync_dir $WEBPATH/$BASE/SRPMS/ /vservers/$BASE/build/SRPMS/ + 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) + vserver $BASE exec bash -c "(cd /build ; dpkg-scanpackages DEBIAN/ | gzip -9c > DEBIAN/Packages.gz)" + webpublish mkdir -p $WEBPATH/$BASE/DEBIAN + webpublish_rsync_files $WEBPATH/$BASE/DEBIAN/ /vservers/$BASE/build/DEBIAN/*.deb + webpublish_rsync_files $WEBPATH/$BASE/ /vservers/$BASE/build/DEBIAN/*.gz + fi # publish myplc-release if this exists release=/vservers/$BASE/build/myplc-release - [ -f $release ] && webpublish_rsync_file $release $WEBPATH/$BASE + [ -f $release ] && webpublish_rsync_files $WEBPATH/$BASE $release set -e # create yum repo and sign packages.