forked from RackHD/on-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_children.sh
30 lines (22 loc) · 1.31 KB
/
build_children.sh
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
#!/bin/bash
#Gets the latest Master build
GetMasterBuild () {
BUILD=$(curl -s 'https://api.travis-ci.org/repos/RackHD/'$1'/branches/master' | grep -o '{"branch":{"id":[0-9]*,' | grep -o '[0-9]' | tr -d '\n')
echo $BUILD
}
# Get last child project build number
BUILD_NUM_DHCP=$(GetMasterBuild on-dhcp-proxy)
BUILD_NUM_TASKS=$(GetMasterBuild on-tasks)
BUILD_NUM_TFTP=$(GetMasterBuild on-tftp)
BUILD_NUM_SYSLOG=$(GetMasterBuild on-syslog)
# Restart last child project build
curl -X POST https://api.travis-ci.org/builds/$BUILD_NUM_DHCP/restart --header "Authorization: token "$AUTH_TOKEN
curl -X POST https://api.travis-ci.org/builds/$BUILD_NUM_TASKS/restart --header "Authorization: token "$AUTH_TOKEN
curl -X POST https://api.travis-ci.org/builds/$BUILD_NUM_TFTP/restart --header "Authorization: token "$AUTH_TOKEN
curl -X POST https://api.travis-ci.org/builds/$BUILD_NUM_SYSLOG/restart --header "Authorization: token "$AUTH_TOKEN
#Echo out what builds where restarted
echo Restarted on-dhcp-proxy Build = $BUILD_NUM_DHCP
echo Restarted on-tasks = $BUILD_NUM_TASKS
echo Restarted on-tftp Build = $BUILD_NUM_TFTP
echo Restarted on-syslog Build = $BUILD_NUM_SYSLOG
echo "Note - on-core restarts builds for on-dhcp-proxy, on-tftp, on-syslog, and on-tasks. When on-tasks succeeds, it restarts builds for on-taskgraph and on-http. "