diff options
Diffstat (limited to 'fetch-autobuild.sh')
-rwxr-xr-x | fetch-autobuild.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fetch-autobuild.sh b/fetch-autobuild.sh new file mode 100755 index 0000000..82a5a3f --- /dev/null +++ b/fetch-autobuild.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +IN_PROGRESS=$(ssh -o ConnectTimeout=10 autobuild cat /home/iurt/autobuild-logs/IN-PROGRESS 2>/dev/null) + +if [ -n "$IN_PROGRESS" ]; then + rsync -qa autobuild:/home/iurt/autobuild-logs/${IN_PROGRESS}/log/ /var/www/bs/autobuild/cauldron/aarch64/core/${IN_PROGRESS}/ +else + LAST=$(ssh -o ConnectTimeout=10 autobuild cat /home/iurt/autobuild-logs/LAST 2>/dev/null) + if [ -n "$LAST" ]; then + # Maybe the machine just booted beween getting IN_PROGRESS and LAST, so ensure IN_PROGRESS is really not there + IN_PROGRESS=$(ssh -o ConnectTimeout=10 autobuild cat /home/iurt/autobuild-logs/IN-PROGRESS 2>/dev/null) + if [ -n "$IN_PROGRESS" ]; then + exit + fi + LAST_CHANGE=$(ssh -o ConnectTimeout=10 autobuild stat -c %Y /home/iurt/autobuild-logs/${LAST}/log/status.core.log) + LOCAL_CHANGE=$(stat -c %Y /var/www/bs/autobuild/cauldron/aarch64/core/${LAST}/status.core.log) + if [ "$LOCAL_CHANGE" != "$LAST_CHANGE" ]; then + rsync -qa autobuild:/home/iurt/autobuild-logs/${LAST}/log/ /var/www/bs/autobuild/cauldron/aarch64/core/${LAST}/ + fi + if [ $(readlink /var/www/bs/autobuild/cauldron/aarch64/core/latest) != ${LAST} ]; then + pushd /var/www/bs/autobuild/cauldron/aarch64/core/ + rm -f latest; ln -s ${LAST} latest + #~/cleanlogs.sh $(\ls -d 2* | tail -n 13 | head -n 10) + popd + echo "Autobuild finished at $(stat -c %y /var/www/bs/autobuild/cauldron/aarch64/core/${LAST}/status.core.log)" + sed -i -e 's/\x00*//' /var/www/bs/autobuild/cauldron/aarch64/core/${LAST}/status.core.log + ruby autobuild2.rb insert /var/www/bs/autobuild/cauldron/aarch64/core/${LAST}/status.core.log + ruby autobuild2.rb report /var/www/bs/autobuild/ + fi + fi +fi |