run_buildbot.sh (1480B)
1 #!/usr/bin/env bash 2 set -x 3 4 BOT_DIR=/b 5 BOT_NAME=$1 6 BOT_PASS=$2 7 8 mkdir -p $BOT_DIR 9 10 #curl "https://repo.stackdriver.com/stack-install.sh" | bash -s -- --write-gcm 11 12 apt-get update -y 13 apt-get upgrade -y 14 15 # 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! 18 apt-get install lld-8 19 rm /usr/bin/ld 20 ln -s /usr/bin/lld-8 /usr/bin/ld 21 22 systemctl set-property buildslave.service TasksMax=100000 23 24 buildslave stop $BOT_DIR 25 26 chown buildbot:buildbot $BOT_DIR 27 28 echo "Connecting as $BOT_NAME" 29 buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 $BOT_NAME $BOT_PASS 30 31 echo "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 42 echo "SLAVE_RUNNER=/usr/bin/buildslave 43 SLAVE_ENABLED[1]=\"1\" 44 SLAVE_NAME[1]=\"buildslave1\" 45 SLAVE_USER[1]=\"buildbot\" 46 SLAVE_BASEDIR[1]=\"$BOT_DIR\" 47 SLAVE_OPTIONS[1]=\"\" 48 SLAVE_PREFIXCMD[1]=\"\"" > /etc/default/buildslave 49 50 chown -R buildbot:buildbot $BOT_DIR 51 systemctl daemon-reload 52 service buildslave restart 53 54 sleep 30 55 cat $BOT_DIR/twistd.log 56 grep "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. 60 sleep 72000 61 while pkill -SIGHUP buildslave; do sleep 5; done; 62 shutdown now