Commit 9f7103b7 authored by Holger Levsen's avatar Holger Levsen
Browse files

reproducible Debian: compress worker's console.logs

parent fd6639d1
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
#!/bin/bash

# Copyright © 2017 Holger Levsen (holger@layer-acht.org)
# Copyright © 2017-2018 Holger Levsen (holger@layer-acht.org)
# released under the GPLv=2

set -e
@@ -29,8 +29,8 @@ if [ ! -d $DIR ] ; then
	echo "$DIR does not exist."
	#echo "Wanted $TARGET but $DIR does not exist."
	exit 0
elif [ ! -f $FILE ] ; then
	echo "$FILE does not exist."
elif [ ! -f $FILE ] && [ ! -f $FILE.gz ] ; then
	echo "Neither $FILE nor FILE.gz exists."
	#echo "Wanted $TARGET but $FILE does not exist."
	exit 0
fi
@@ -43,18 +43,26 @@ let NEW_BUILD=$BUILD+1
#
# if this ain't the latest build, just cat it's logfile
#
if [ -e $DIR/$NEW_BUILD/console.log ] ; then
	cat $FILE
if [ -e $DIR/$NEW_BUILD/console.log.gz ] ; then
	zcat $FILE
#
# if the worker ain't running, just cat the logfile
#
elif [ ! -z "$(ps fax|grep -v grep|grep 'reproducible_worker $WORKER.sh ')" ] ; then
	if [ -f $FILE.gz ] ; then
		cat $FILE
	else
		zcat $FILE.gz
	fi
#
# FIXME: we should really just convert 'latest' into a number here and use the tail below… 
#
elif [ "$BUILD" = "latest" ] ; then
	if [ -f $FILE.gz ] ; then
		cat $FILE
	else
		zcat $FILE.gz
	fi
else
	#
	# else, we tail the logfile and kill the tail process, once the next build
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ while true ; do
	echo
	RETCODE=0
	/srv/jenkins/bin/reproducible_build.sh $NODE1 $NODE2 >$BUILD_BASE/$BUILD_ID/console.log 2>&1 || RETCODE=$?
	gzip $BUILD_BASE/$BUILD_ID/console.log || true
	echo

	[ "$RETCODE" -eq 0 ] || notify_log_of_failure