blob: 3b464516868492e1d974e659e2c3fb183f0c390d (
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/bin/sh
#
# This is a helper script to make it easier for me to test all ick
# compontents together.
#
# This script optionally installs (based on first arg: yes or no) ick
# on a cluster, and then sets up a couple of test projects, and builds
# those.
#
# See the run-cluster.sh file for how the cluster is set up.
#
# The ci-vars.yaml file has the variables for setting up the test
# instance.
#
# See ickdev.yaml for the ick projects that are set up: ick_streatch
# and ick2. If you change the project names, you need to edit this
# file.
#
# This script assume you have icktool installed and configured, and
# that the ick2-ansible repository is checked out at a given location
# (see below). Also the ick rules are checked out (liw-ci repo). Also,
# the cluster hostnames are listed in hosts.ickdev. All of the various
# values work for me. If you'd like to make this more general, that'd
# be fantastic: please submit patches.
#
# Lars Wirzenius
set -eu
run_ansible="$1"
ci_dist="$2"
prefix="$3"
ansible="$HOME/code/ick/ick2-ansible"
rules="$HOME/code/ick/liw-ci"
controller="https://ickdev2-controller.vm.liw.fi"
tool()
{
"$HOME/code/ick/ick2/icktool" -c "$controller" --no-verify-tls "$@"
}
build_status()
{
tool status | awk -v "p=$1" '$1 == p { print $5 }'
}
current_log()
{
tool status | awk -v "p=$1" '$1 == p { print $7 }'
}
wait_for_build_to_start()
{
local project="$1"
local prevlog="$2"
echo "Waiting for build of $project to start"
while true
do
log="$(current_log "$project")"
[ "$log" != "" ]
[ "$prevlog" != "" ]
if [ "$log" = "$prevlog" ]
then
# Build hasn't started
sleep 5
continue
fi
break
done
echo "Project $project build has started"
}
wait_for_build_to_finish()
{
local project="$1"
echo "Waiting for build of $project to finish"
while true
do
bs="$(build_status "$project")"
case "$bs" in
OK) echo "Build is finished"; break ;;
building) sleep 5; continue ;;
FAILED*) echo "Build failed: $bs" 1>&2 ; exit 1 ;;
*) echo "Don't understand build status $bs" 1>&2 ; exit 1 ;;
esac
done
}
build()
{
local project="$1"
local log="$(current_log "$project")"
echo "Triggering $project"
tool trigger "$project"
wait_for_build_to_start "$project" "$log"
wait_for_build_to_finish "$project"
}
if [ "$run_ansible" = yes ]
then
cd "$ansible"
./run-cluster.sh hosts.ickdev -e "ick_prefix=$prefix" -e "ci_dist=$ci_dist" -e @ci-vars.yml
fi
tool make-it-so < "${rules}/ickdev.yaml"
build ick_stretch
build ick2
|