infra/codestorage/hg-ssh
2015-10-15
Parent:bc0c83d5015d
infra/codestorage/hg-ssh/post-commit-broadcast.sh
Pull hostkeys when pulling SSH keys. Rather than relying on Kubernetes secrets and baking public keys right in, which was bound to get fraught, we now have some graceful degradation. It defaults to automatically-generated random keys, but will try to download some keys from Google Cloud Storage for the host. If it can find some, it'll try to use those, instead.
1 #!/bin/bash
3 cwd=`/bin/pwd`
4 me=`whoami`
5 stripped=${cwd#/home/$me/repos/}
7 if [ $stripped = $cwd ]
8 then
9 stripped=${cwd#/mounted/repos/}
10 fi
12 if [ $stripped = $cwd ]
13 then
14 echo "Can't get repo name from ${cwd} aborting"
15 exit 0
16 fi
18 FRONTENDS=$(dig mercurial-uwsgi-headless +short +search)
19 for fe in $FRONTENDS
20 do
21 hg push http://${fe}:8080/${stripped}
22 done
24 exit 0