blob: eca9451ef766117facd8ce9aedddb3853eada449 (
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#!/bin/bash
set -ex
image="$1"
buildmaster="$2"
slavename="$3"
password="$4"
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
case "$buildmaster" in
"normal")
mastername="normal"
masterurl="lab.llvm.org:9990"
;;
"silent")
mastername="silent"
masterurl="lab.llvm.org:9994"
;;
*)
mastername="custom"
masterurl="$buildmaster"
esac
# CXX, LLD and LNT bots need additional configuration, and
# are not supported yet.
case "$mastername:$slavename:$(hostname):$image" in
# No restrictions for custom masters:
custom:*:*:*) ;;
# 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
case "$slavename" in
linaro-armv8-*)
# Use 64G out of 128G.
memlimit="64"
;;
*)
# Use at most 30G or 90% of all RAM.
memlimit=$(($(free -g | awk '/^Mem/ { print $2 }') * 9 / 10))
if [ "$memlimit" -gt "30" ]; then
memlimit="30"
fi
;;
esac
# 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"
$DOCKER run --name=$mastername-$slavename --hostname=$mastername-$slavename --restart=unless-stopped -dt -p 22 --memory=${memlimit}G --pids-limit=5000 $caps "$image" "$masterurl" "$slavename" "$password"
|