| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
set -euo pipefail |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
if [[ -r /etc/sando/sando.env ]]; then |
| 15 |
set -a |
| 16 |
|
| 17 |
source /etc/sando/sando.env |
| 18 |
set +a |
| 19 |
fi |
| 20 |
|
| 21 |
DAEMON_URL="${SANDO_DAEMON:-http://127.0.0.1:7766}" |
| 22 |
DEPLOY_BRANCH="${SANDO_BRANCH:-main}" |
| 23 |
|
| 24 |
while read -r oldsha newsha ref; do |
| 25 |
if [[ "$ref" != "refs/heads/$DEPLOY_BRANCH" ]]; then |
| 26 |
continue |
| 27 |
fi |
| 28 |
if [[ "$newsha" == "0000000000000000000000000000000000000000" ]]; then |
| 29 |
|
| 30 |
continue |
| 31 |
fi |
| 32 |
echo "sando: posting rebuild for $newsha" |
| 33 |
curl --silent --show-error --fail \ |
| 34 |
-X POST "$DAEMON_URL/rebuild" \ |
| 35 |
-H 'Content-Type: application/json' \ |
| 36 |
-d "{\"sha\":\"$newsha\"}" \ |
| 37 |
|| echo "sando: rebuild trigger failed; check daemon" |
| 38 |
done |
| 39 |
|