From: Holger Levsen Date: Wed, 24 Oct 2012 15:08:12 +0000 (+0200) Subject: split into two scripts to speed up things X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=9484f401c41338e3194f5663cf0f96a65855027b;p=profitbricks%2Fjenkins-build-scripts.git split into two scripts to speed up things --- diff --git a/liveboot_build.sh b/liveboot_build.sh index a9b0bc8..4f97d46 100755 --- a/liveboot_build.sh +++ b/liveboot_build.sh @@ -23,19 +23,6 @@ fi # export DIST=squeeze export PB_SUITE=production-proposed-updates -RSYNC_SRC=/srv/mirror/liveboot -RSYNC_FILTER='' - -# ri server -RSYNC_DST1="liveboot@riserver/liveboot/" -# storage DC (mgmt11) -RSYNC_DST2="liveboot@10.251.1.1/liveboot/" -# pbb (mgmt5) -RSYNC_DST3="liveboot@10.254.1.1/liveboot/" -# staging (mgmt9) -RSYNC_DST4="liveboot@10.252.1.1/liveboot/" -# dc1+2 (mgmt1) -RSYNC_DST5="liveboot@10.1.1.1/liveboot/" SCRIPTSDIR=$(dirname $0) BUILD_SCRIPT=$(mktemp) @@ -78,47 +65,11 @@ sudo mv *-* /srv/mirror/liveboot cd /srv/build/ sudo rm liveboot -Rf -# TODO: implement better garbage collection, allow to keep images -# TODO: needs to update the db too -# -# cleanup $RSYNC_SRC, keep MAX number of images # -MAX=15 -cd $RSYNC_SRC -COUNT=0 -for i in $(ls -atd1 ./liveboot-*) ; do - let COUNT=COUNT+1 - if [ $COUNT -gt $MAX ] ; then - sudo rm -rfv ./$i - else - echo "keeping $i" - fi -done - -# -# Mirror +# remove trap to not set failure at the end :) # -echo -echo "Now rsyncing results to $RSYNC_DST1 ..." -rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST1 -figlet "mirror to r+i OK" -echo "Now rsyncing results to $RSYNC_DST2 ..." -rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST2 -figlet "mirror to storage-dc OK" -echo "Now rsyncing results to $RSYNC_DST3 ..." -rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST3 -figlet "mirror to pbb OK" -echo "Now rsyncing results to $RSYNC_DST4 ..." -rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST4 -figlet "mirror to staging OK" -echo "Now rsyncing results to $RSYNC_DST5 ..." -rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST5 -figlet "mirror to DC1+2 OK" +trap - INT TERM EXIT -du -sh /srv/mirror/liveboot +# all is good, mother. figlet "OK" -# -# remove trap to not set failure at the end :) -# -trap - INT TERM EXIT diff --git a/liveboot_rsync.sh b/liveboot_rsync.sh new file mode 100755 index 0000000..d709251 --- /dev/null +++ b/liveboot_rsync.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# copyright 2012 Holger Levsen +# GPL2 licenced + +set -e +#set -x +export + + +# +# Define default settings +# +RSYNC_SRC=/srv/mirror/liveboot +RSYNC_FILTER='' + +# ri server +RSYNC_DST1="liveboot@riserver/liveboot/" +# storage DC (mgmt11) +RSYNC_DST2="liveboot@10.251.1.1/liveboot/" +# pbb (mgmt5) +RSYNC_DST3="liveboot@10.254.1.1/liveboot/" +# staging (mgmt9) +RSYNC_DST4="liveboot@10.252.1.1/liveboot/" +# dc1+2 (mgmt1) +RSYNC_DST5="liveboot@10.1.1.1/liveboot/" + +# TODO: implement better garbage collection, allow to keep images +# TODO: needs to update the db too +# FIXME: locking +# +# cleanup $RSYNC_SRC, keep MAX number of images +# +MAX=15 +cd $RSYNC_SRC +COUNT=0 +for i in $(ls -atd1 ./liveboot-*) ; do + let COUNT=COUNT+1 + if [ $COUNT -gt $MAX ] ; then + sudo rm -rfv ./$i + else + echo "keeping $i" + fi +done + +# +# Mirror +# +echo +echo "Now rsyncing results to $RSYNC_DST1 ..." +rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST1 +figlet "mirror to r+i OK" +echo "Now rsyncing results to $RSYNC_DST2 ..." +rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST2 +figlet "mirror to storage-dc OK" +echo "Now rsyncing results to $RSYNC_DST3 ..." +rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST3 +figlet "mirror to pbb OK" +echo "Now rsyncing results to $RSYNC_DST4 ..." +rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST4 +figlet "mirror to staging OK" +echo "Now rsyncing results to $RSYNC_DST5 ..." +rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST5 +figlet "mirror to DC1+2 OK" + +du -sh /srv/mirror/liveboot +figlet "OK" +