diff options
author | Eric Fiselier <eric@efcs.ca> | 2019-04-28 15:54:50 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2019-04-28 15:54:50 +0000 |
commit | 2f5f9a159bce94c2b8b917cc6480a798b0eaf358 (patch) | |
tree | bf9397e41ae122c9108097145239a8dd804b9687 /libcxx/utils/docker | |
parent | 7a94795b2b7fb9eb3f9bbfa514f3b28fec59408a (diff) | |
download | bcm5719-llvm-2f5f9a159bce94c2b8b917cc6480a798b0eaf358.tar.gz bcm5719-llvm-2f5f9a159bce94c2b8b917cc6480a798b0eaf358.zip |
Attempt to switch to auto-scaling bots
llvm-svn: 359403
Diffstat (limited to 'libcxx/utils/docker')
-rw-r--r-- | libcxx/utils/docker/debian9/Dockerfile | 2 | ||||
-rwxr-xr-x | libcxx/utils/docker/scripts/run_buildbot.sh | 10 | ||||
-rwxr-xr-x | libcxx/utils/docker/scripts/run_buildbot_new.sh | 105 |
3 files changed, 117 insertions, 0 deletions
diff --git a/libcxx/utils/docker/debian9/Dockerfile b/libcxx/utils/docker/debian9/Dockerfile index 46875f42807..1dfeb0681ef 100644 --- a/libcxx/utils/docker/debian9/Dockerfile +++ b/libcxx/utils/docker/debian9/Dockerfile @@ -165,6 +165,8 @@ RUN ln -s /opt/gcc-5/bin/gcc /usr/local/bin/gcc-4.9 && \ RUN apt-get update && \ apt-get install -y --no-install-recommends \ bash-completion \ + vim \ + systemd-sysv \ buildbot-slave \ && rm -rf /var/lib/apt/lists/* diff --git a/libcxx/utils/docker/scripts/run_buildbot.sh b/libcxx/utils/docker/scripts/run_buildbot.sh index c135fc4af89..ede004913cf 100755 --- a/libcxx/utils/docker/scripts/run_buildbot.sh +++ b/libcxx/utils/docker/scripts/run_buildbot.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash set -x +script_dir=`dirname "$0"` + +# TODO(EricWF): Replace this file with the new script once the existing +# bots have been migrated. +if [ "$1" == "--new" ]; then + shift + $script_dir/run_buildbot_new.sh "$@" + shutdown now +fi + BOT_DIR=/b BOT_NAME=$1 BOT_PASS=$2 diff --git a/libcxx/utils/docker/scripts/run_buildbot_new.sh b/libcxx/utils/docker/scripts/run_buildbot_new.sh new file mode 100755 index 00000000000..3f21b9078ac --- /dev/null +++ b/libcxx/utils/docker/scripts/run_buildbot_new.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +set -x + +BOT_ROOT=/b +BOT_ROOT_NAME=$1 +BOT_PASS=$2 + +pushd /tmp +curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh +bash install-monitoring-agent.sh +curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh +bash install-logging-agent.sh --structured +popd + +apt-get update -y +apt-get upgrade -y + +# FIXME(EricWF): Remove this hack. It's only in place to temporarily fix linking libclang_rt from the +# debian packages. +# WARNING: If you're not a buildbot, DO NOT RUN! +apt-get install lld-9 +rm /usr/bin/ld +ln -s /usr/bin/lld-9 /usr/bin/ld + +systemctl set-property buildslave.service TasksMax=100000 + +systemctl daemon-reload +service buildslave restart + +function setup_numbered_bot { + local BOT_NAME=$1 + local BOT_DIR=$2 + mkdir -p $BOT_DIR + + buildslave stop $BOT_DIR + chown buildbot:buildbot $BOT_DIR + rm -rf $BOT_DIR/* + + buildslave create-slave --allow-shutdown=signal $BOT_DIR lab.llvm.org:9990 \ + $BOT_NAME $BOT_PASS + + echo "Eric Fiselier <ericwf@google.com>" > $BOT_DIR/info/admin + + echo "Connecting as $BOT_BASE_NAME$1" + { + uname -a | head -n1 + cmake --version | head -n1 + g++ --version | head -n1 + ld --version | head -n1 + date + lscpu + } > $BOT_DIR/info/host + + + # echo "SLAVE_RUNNER=/usr/bin/buildslave + # SLAVE_ENABLED[1]=\"1\" + # SLAVE_NAME[1]=\"buildslave$1\" + # SLAVE_USER[1]=\"buildbot\" + # SLAVE_BASEDIR[1]=\"$BOT_DIR\" + # SLAVE_OPTIONS[1]=\"\" + # SLAVE_PREFIXCMD[1]=\"\"" > $BOT_DIR/buildslave.cfg + +} + +function try_start_builder { + local $N=$1 + local BOT_DIR=$BOT_ROOT/b$N + local BOT_NAME=$BOT_ROOT_NAME$N + setup_numbered_bot $BOT_NAME $BOT_DIR + /usr/bin/buildslave start $BOT_DIR + + sleep 30 + cat /tmp/twistd.log + if grep --quiet "slave is ready" $BOT_DIR/twistd.log; then + return 0 + fi + if grep "rejecting duplicate slave" $BOT_DIR/twistd.log; then + return 1 + fi + echo "Unknown error" + cat $BOT_DIR/twistd.log + exit 1 +} + + +for N in 1 2 3 4 5 +do + if try_start_builder $N; then + break + fi + echo "failed to start any buildbot" + shutdown now +done + +# GCE can restart instance after 24h in the middle of the build. +# Gracefully restart before that happen. +sleep 72000 +while pkill -SIGHUP buildslave; do sleep 5; done; +shutdown now + +echo "Failed to start any buildbot" +shutdown now + + + |