From 1e77676e09f56c7818bf142b154eba50b40a1094 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sun, 6 Sep 2015 14:54:59 +0200 Subject: reproducible: refactoring --- bin/reproducible_build.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'bin/reproducible_build.sh') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 479ba1af..b2a1d779 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -264,6 +264,14 @@ handle_reproducible() { fi } +handle_unhandled() { + MESSAGE="$BUILD_URL met an unhandled $1, please investigate." + echo "$MESSAGE" + irc_msg "$MESSAGE" + /srv/jenkins/bin/abort.sh + exit 0 +} + dbd_timeout() { local msg="$DIFFOSCOPE was killed after running into timeout after $1" if [ ! -s ./${DBDREPORT} ] ; then @@ -516,14 +524,12 @@ check_buildinfo() { if [ $RESULT -eq 148 ] ; then handle_404 elif [ $RESULT -ne 0 ] ; then - echo "Unhandled exit code from remote build job, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "exit code from remote build job" fi rsync -e "ssh -p $PORT1" -r $NODE1:$TMPDIR/b1 $TMPDIR/ RESULT=$? if [ $RESULT -ne 0 ] ; then - echo "Unhandled error when rsyncing remote build job results, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "error when rsyncing remote build results" fi ls -R $TMPDIR ssh -p $PORT1 $NODE1 "rm -r $TMPDIR" @@ -552,14 +558,12 @@ build_rebuild() { if [ $RESULT -eq 148 ] ; then handle_404 elif [ $RESULT -ne 0 ] ; then - echo "Unhandled exit code from remote build job, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "exit code from remote build job" fi rsync -e "ssh -p $PORT1" -r $NODE1:$TMPDIR/b1 $TMPDIR/ RESULT=$? if [ $RESULT -ne 0 ] ; then - echo "Unhandled error when rsyncing remote build job results, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "error when rsyncing remote build results" fi ls -R $TMPDIR ssh -p $PORT1 $NODE1 "rm -r $TMPDIR" @@ -586,14 +590,12 @@ build_rebuild() { if [ $RESULT -eq 148 ] ; then handle_404 elif [ $RESULT -ne 0 ] ; then - echo "Unhandled exit code from remote build job, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "exit code from remote build job" fi rsync -e "ssh -p $PORT2" -r $NODE2:$TMPDIR/b2 $TMPDIR/ RESULT=$? if [ $RESULT -ne 0 ] ; then - echo "Unhandled error when rsyncing remote build job results, please investigate." - /srv/jenkins/bin/abort.sh + handle_unhandled "error when rsyncing remote build results" fi ls -R $TMPDIR ssh -p $PORT2 $NODE2 "rm -r $TMPDIR" -- cgit v1.2.3-70-g09d2