infra/codestorage/hg-ssh
2015-10-14
Parent:121585c71fd7
infra/codestorage/hg-ssh/post-commit-broadcast.sh
Use the relative DNS address. Use the relative DNS address when digging for web frontends, which now works thanks to +search on dig. This allows us to transfer between namespaces without needing to change anything. Also makes this, in general, more flexible.
| paddy@2 | 1 #!/bin/bash |
| paddy@2 | 2 |
| paddy@2 | 3 cwd=`/bin/pwd` |
| paddy@2 | 4 me=`whoami` |
| paddy@2 | 5 stripped=${cwd#/home/$me/repos/} |
| paddy@2 | 6 |
| paddy@2 | 7 if [ $stripped = $cwd ] |
| paddy@2 | 8 then |
| paddy@2 | 9 stripped=${cwd#/mounted/repos/} |
| paddy@2 | 10 fi |
| paddy@2 | 11 |
| paddy@2 | 12 if [ $stripped = $cwd ] |
| paddy@2 | 13 then |
| paddy@2 | 14 echo "Can't get repo name from ${cwd} aborting" |
| paddy@2 | 15 exit 0 |
| paddy@2 | 16 fi |
| paddy@2 | 17 |
| paddy@3 | 18 FRONTENDS=$(dig mercurial-uwsgi-headless +short +search) |
| paddy@2 | 19 for fe in $FRONTENDS |
| paddy@2 | 20 do |
| paddy@2 | 21 hg push http://${fe}:8080/${stripped} |
| paddy@2 | 22 done |
| paddy@2 | 23 |
| paddy@2 | 24 exit 0 |