blob: 968dbe84298ed0cddf57dc5189ccbb95d3f410a0 (
plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/bash
set -ex
buildmaster="$1"
slavename="$2"
usage ()
{
echo "$@"
cat <<EOF
Usage: $0 <buildmaster> <buildslave> <password>
E.g., $0 lab.llvm.org:9994 linaro-apm-05 PASSWORD
EOF
exit 1
}
if groups 2>/dev/null | grep -q docker; then
# Run docker straight up if $USER is in "docker" group.
DOCKER="docker"
else
# Fallback to sudo otherwise.
DOCKER="sudo docker"
fi
image=@IMAGE@
# Use at most 15G or 90% of all RAM.
memlimit=$(($(free -g | awk '/^Mem/ { print $2 }') * 9 / 10))
if [ "$memlimit" -gt "15" ]; then
memlimit="15"
fi
# IPC_LOCK is required for some implementations of ssh-agent (e.g., MATE's).
# SYS_PTRACE is required for debugger work.
# seccomp:unconfined is required to disable ASLR for sanitizer tests.
caps="--cap-add=IPC_LOCK --cap-add=SYS_PTRACE --security-opt seccomp:unconfined"
case "$buildmaster" in
"lab.llvm.org:9990")
mastername="normal"
;;
"lab.llvm.org:9994")
mastername="silent"
;;
*)
usage "ERROR: Wrong buildmaster URL: $buildmaster"
esac
# CXX, LLD and LNT bots need additional configuration, and
# are not supported yet.
case "$mastername:$slavename:$(hostname):$image" in
# Almost no restrictions for the silent master:
silent:*:r*-a*:*) ;;
silent:linaro-tk1-*:llvm-tk1-*:*-armhf-*) ;;
# Restrictions for the normal master:
normal:linaro-apm-01:r1-a22:*-arm64-*) ;;
normal:linaro-apm-02:r1-a21:*-arm64-*) ;;
#normal:linaro-apm-03:r1-a20:*-arm64-*) ;;
#normal:linaro-apm-04:r2-a26:*-arm64-*) ;;
normal:linaro-apm-05:r2-a27:*-arm64-*) ;;
normal:linaro-apm-06:r2-a28:*-arm64-*) ;;
#normal:linaro-tk1-01:llvm-tk1-01:*-armhf-*) ;;
#normal:linaro-tk1-02:llvm-tk1-02:*-armhf-*) ;;
#normal:linaro-tk1-03:llvm-tk1-03:*-armhf-*) ;;
normal:linaro-tk1-04:llvm-tk1-04:*-armhf-*) ;;
normal:linaro-tk1-05:llvm-tk1-05:*-armhf-*) ;;
normal:linaro-tk1-06:llvm-tk1-06:*-armhf-*) ;;
normal:linaro-tk1-07:llvm-tk1-07:*-armhf-*) ;;
normal:linaro-tk1-08:llvm-tk1-08:*-armhf-*) ;;
normal:linaro-tk1-09:llvm-tk1-09:*-armhf-*) ;;
*)
usage "ERROR: Wrong mastername:slavename:hostname:image combination: $mastername:$slavename:$(hostname):$image"
;;
esac
$DOCKER pull $image
$DOCKER run --name=$mastername-$slavename --hostname=$mastername-$slavename --restart=unless-stopped -dt -p 22 --memory=${memlimit}G --pids-limit=5000 $caps $image "$@"
|