patchew-project / patchew

A patch email tracking and testing system
MIT License
72 stars 24 forks source link

Add auto-update to ansible playbooks #111

Open bonzini opened 5 years ago

bonzini commented 5 years ago

Currently this script is used via cron on patchew.org and next.patchew.org to auto-update the servers:

#!/bin/bash

set -e

BRANCH=master
INSTANCE=patchew-server

cd ~/patchew.git
git fetch

cur=$(git rev-parse $BRANCH)
if test -f ~/.$INSTANCE-head; then
    prev=$(cat ~/.$INSTANCE-head)
fi
if [ "$cur" = "$prev" ]; then
    exit 0
fi

rm -rf /tmp/$INSTANCE-deploy2
git clone -b $BRANCH ~/patchew.git /tmp/$INSTANCE-deploy2
cd /tmp/$INSTANCE-deploy2
./scripts/deploy -s root@localhost -e 'instance_name="'"$INSTANCE"'" superuser_name="" superuser_pass=""'

echo $cur > ~/.$INSTANCE-head

The script should be moved to an Ansible playbook.