#!/bin/sh leap_cli_updated() { # master is currently broken anyway, lets wait for 0.3 #do_testdeploy '/etc/leap/rewire_master.cfg' do_testdeploy '/etc/leap/rewire_develop.cfg' } leap_platform_updated() { case $branch in 'master') do_testdeploy '/etc/leap/rewire_master.cfg' ;; 'develop') do_testdeploy '/etc/leap/rewire_develop.cfg' ;; '0.6') do_testdeploy '/etc/leap/rewire_0.6.cfg' ;; 'citest') do_testdeploy '/etc/leap/rewire_citest.cfg' ;; *) echo "Branch $branch not recognized. exiting."; exit 1;; esac } do_testdeploy() { cmd="/usr/local/bin/platform_test/leap-platform-test -c $1 --all reset_deploy" echo "`date`: Branch \"$branch\" in repo \"$repo\" was updated" >> $LOG name="leap-platform-test-`date +'%F-%H%M%S'`" echo "Running this cmd in a detatched screen session named $name: $cmd" | tee -a $LOG screen -s /bin/bash -S $name -d -m $cmd } LOG='/var/log/leap/leap-repo-updated.log' repo=$1 # example of $2: "refs/heads/test_ci" branch=`echo $2 | cut -d'/' -f 3` case "$repo" in 'leap_platform') leap_platform_updated;; 'leap_cli') leap_cli_updated;; *) echo "Repo \"$repo\" not recognized. exiting."; exit 1;; esac