blob: 10cc09b6f537c03f0f8bf29c1b56147f6f26ca66 [file] [log] [blame]
Eric Fiselier9c97ca12018-11-19 18:43:31 +00001#!/usr/bin/env bash
2set -x
3
4BOT_DIR=/b
5BOT_NAME=$1
6BOT_PASS=$2
7
8mkdir -p $BOT_DIR
9
10#curl "https://repo.stackdriver.com/stack-install.sh" | bash -s -- --write-gcm
11
12apt-get update -y
13apt-get upgrade -y
14
15systemctl set-property buildslave.service TasksMax=100000
16
17buildslave stop $BOT_DIR
18
19chown buildbot:buildbot $BOT_DIR
20
21echo "Connecting as $BOT_NAME"
22buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 $BOT_NAME $BOT_PASS
23
24echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin
25
26{
27 uname -a | head -n1
28 cmake --version | head -n1
29 g++ --version | head -n1
30 ld --version | head -n1
31 date
32 lscpu
33} > $BOT_DIR/info/host
34
35echo "SLAVE_RUNNER=/usr/bin/buildslave
36SLAVE_ENABLED[1]=\"1\"
37SLAVE_NAME[1]=\"buildslave1\"
38SLAVE_USER[1]=\"buildbot\"
39SLAVE_BASEDIR[1]=\"$BOT_DIR\"
40SLAVE_OPTIONS[1]=\"\"
41SLAVE_PREFIXCMD[1]=\"\"" > /etc/default/buildslave
42
43chown -R buildbot:buildbot $BOT_DIR
44systemctl daemon-reload
45service buildslave restart
46
47sleep 30
48cat $BOT_DIR/twistd.log
49grep "slave is ready" $BOT_DIR/twistd.log || shutdown now
50
51# GCE can restart instance after 24h in the middle of the build.
52# Gracefully restart before that happen.
53sleep 72000
54while pkill -SIGHUP buildslave; do sleep 5; done;
55shutdown now