From: Mathias Klette Date: Tue, 26 Jun 2012 10:53:42 +0000 (+0200) Subject: adding comments X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=1aad8d1cc52fc3348d6ccbe9873034633fad3816;p=profitbricks%2Fjenkins-build-scripts.git adding comments --- diff --git a/live_build.sh b/live_build.sh index 05375e7..837b6c6 100755 --- a/live_build.sh +++ b/live_build.sh @@ -3,17 +3,34 @@ set -e -if [ "$1" == "" ] ; then +if [ -z "${BUILD_NUMBER}" ] +then + echo "\$BUILD_NUMBER is empty, not using Jenkins? Please export manually!" + exit 1 +fi + +# +# Define default profile if none is given +# +if [ "$1" == "" ] +then LIVE_TYPE="staging" else LIVE_TYPE=$1 fi +# +# Define default settings +# RSYNC_BASE=/srv/mirror/live-build BUILD_DATE=$(date +%Y%m%d%H%M) BUILD_ID="${LIVE_TYPE}-${BUILD_DATE}-${BUILD_NUMBER}" # BUILD_ID is used without lb_build.sh... BUILD_TARGET=$RSYNC_BASE/$BUILD_ID +# +# Overwrite settings depending on profile used +# - i.e. not enough space in PBB to contain all images +# case $LIVE_TYPE in default|staging) RSYNC_SRC="$RSYNC_BASE/" @@ -25,8 +42,14 @@ case $LIVE_TYPE in ;; esac +# +# Export variables for upcoming sudo-calls +# export LIVE_TYPE TARGET_RSYNC BUILD_DATE BUILD_ID BUILD_TARGET TARGET_BASE +# +# Build +# figlet "building $LIVE_TYPE with build_id $BUILD_ID" cd pserver.flexible @@ -36,6 +59,11 @@ sudo bash ./lb_build.sh -p $LIVE_TYPE ls -larth tftpboot/debian-live/amd64/ ls -larth binary/live/ +figlet "build OK" + +# +# Deploy +# mkdir -p $BUILD_TARGET echo "Finally copying results..." @@ -43,14 +71,18 @@ echo "Finally copying results..." cp -v tftpboot/debian-live/amd64/initrd.img-3* tftpboot/debian-live/amd64/vmlinuz-3* $BUILD_TARGET/ cp -v binary/live/filesystem.squashfs $BUILD_TARGET/ -figlet "success" +figlet "deploy OK" + +# +# Mirror +# echo sort binary/live/filesystem.packages echo echo "Now rsyncing results to $RSYNC_BASE ..." rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete $RSYNC_SRC/ rsync://$RSYNC_DST -figlet "rsync success" +figlet "mirror OK" # # cleanup /srv/mirror, keep MAX number of images @@ -67,3 +99,4 @@ for i in $(ls -artd1 ./${LIVE_TYPE}-*) ; do fi done +figlet "cleanup OK"