summaryrefslogtreecommitdiff
path: root/leap-repo-updated
blob: 43f437d1e9f8f0b797e5f30340987f883623ad75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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