summaryrefslogtreecommitdiff
path: root/tcwg-update-llvmbot-containers.sh
blob: fd03b99871e2929b72b2a2467a62b05ac586e14e (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 -euf -o pipefail

scripts=$(dirname $0)
# shellcheck source=jenkins-helpers.sh
. $scripts/jenkins-helpers.sh
convert_args_to_variables "$@"

obligatory_variables NODE_NAME password

distro="${distro-xenial}"
force="${force-false}"
master="${master-silent}"
verbose="${verbose-true}"

if $verbose; then set -x; fi

if $force; then
    keep_existing=false
else
    keep_existing=keep_if_same_image
fi

case "$NODE_NAME:$master" in
    tcwg-amp-03:normal)
	bot_prefix=linaro-armv8-01-
	bots=(
	    aarch64-full
	    aarch64-global-isel
	)
	;;
    tcwg-amp-04:normal)
	bot_prefix=linaro-armv8-01-
	bots=(
	    arm-selfhost-neon
	    arm-global-isel
	)
	;;
    tcwg-llvmbot_d05-01:normal)
	bot_prefix=linaro-armv8-01-
	bots=(
	    aarch64-libcxx
	    aarch64-libcxx-noeh
	    aarch64-lld
	    aarch64-quick
	    arm-libcxx
	    arm-libcxx-noeh
	    arm-lld
	    arm-lnt
	    arm-quick
	)
	;;
    tcwg-llvmbot_tk1-*:normal)
	bot_prefix=""
	bots=("$(echo "$NODE_NAME" | sed -e "s/tcwg-llvmbot_/linaro-/")")
	;;
esac

for bot in "${bots[@]+${bots[@]}}"; do
    case "$bot" in
	aarch64-*) arch="arm64" ;;
	arm-*|linaro-tk1-*) arch="armhf" ;;
	*) echo "ERROR: Unknown bot: $bot"; exit 1 ;;
    esac
    image="linaro/ci-$arch-tcwg-llvmbot-ubuntu:$distro"

    # shellcheck disable=SC2154
    $scripts/tcwg-start-container.sh \
	--container "$master-${bot_prefix}$bot" \
	--image "$image" \
	--keep_existing "$keep_existing" \
	--verbose "$verbose" \
	-- \
	$image $master ${bot_prefix}$bot $password
done