#!/bin/sh leap_cli_updated() { # only test on develop for now cfg='/etc/leap/rewire_develop.cfg' } leap_platform_updated() { case $branch in 'master') cfg='/etc/leap/rewire_master.cfg' ;; 'develop') cfg='/etc/leap/rewire_develop.cfg' ;; 'test_ci') cfg='/etc/leap/rewire_develop.cfg' ;; *) echo "Branch $branch not recognized. exiting."; exit 1;; esac } 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 cmd="/usr/local/bin/platform_test/leap-platform-test -c $cfg --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