blob: 96e832dd4e46caf085e797d896c4c7e4cc3561b2 [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
Eric Fiselier4e903a32018-12-15 03:24:33 +000015# FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the
16# debian packages.
17# WARNING: If you're not a buildbot, DO NOT RUN!
Eric Fiselier8c033222019-01-19 09:07:04 +000018apt-get install lld-9
Eric Fiselier4e903a32018-12-15 03:24:33 +000019rm /usr/bin/ld
Eric Fiselier8c033222019-01-19 09:07:04 +000020ln -s /usr/bin/lld-9 /usr/bin/ld
Eric Fiselier4e903a32018-12-15 03:24:33 +000021
Eric Fiselier9c97ca12018-11-19 18:43:31 +000022systemctl set-property buildslave.service TasksMax=100000
23
24buildslave stop $BOT_DIR
25
26chown buildbot:buildbot $BOT_DIR
27
28echo "Connecting as $BOT_NAME"
29buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 $BOT_NAME $BOT_PASS
30
31echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin
32
33{
34 uname -a | head -n1
35 cmake --version | head -n1
36 g++ --version | head -n1
37 ld --version | head -n1
38 date
39 lscpu
40} > $BOT_DIR/info/host
41
42echo "SLAVE_RUNNER=/usr/bin/buildslave
43SLAVE_ENABLED[1]=\"1\"
44SLAVE_NAME[1]=\"buildslave1\"
45SLAVE_USER[1]=\"buildbot\"
46SLAVE_BASEDIR[1]=\"$BOT_DIR\"
47SLAVE_OPTIONS[1]=\"\"
48SLAVE_PREFIXCMD[1]=\"\"" > /etc/default/buildslave
49
50chown -R buildbot:buildbot $BOT_DIR
51systemctl daemon-reload
52service buildslave restart
53
54sleep 30
55cat $BOT_DIR/twistd.log
56grep "slave is ready" $BOT_DIR/twistd.log || shutdown now
57
58# GCE can restart instance after 24h in the middle of the build.
59# Gracefully restart before that happen.
60sleep 72000
61while pkill -SIGHUP buildslave; do sleep 5; done;
Eric Fiselier8c033222019-01-19 09:07:04 +000062shutdown now