-
Notifications
You must be signed in to change notification settings - Fork 16
/
jenkins-deb-AIO-install
executable file
·152 lines (117 loc) · 3.61 KB
/
jenkins-deb-AIO-install
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# $1 = test repo number
#
# force a local default so this can be run on command line
DISTRELEASE=${DISTRELEASE-ubuntu-natty}
PACKAGE_REPO=${PACKAGE_REPO-unstable}
COMPONENT=${COMPONENT-diablo-final}
[ -e $(dirname $0)/jenkins-deb-common ] || exit 1
. $(dirname $0)/jenkins-deb-common
jenkins_init
jenkins_set_vars
echo ${DISTRELEASE}
echo ${PACKAGE_REPO}
echo ${COMPONENT}
KONG_BRANCH=${NOVA_RELEASE}-${MILESTONE}
if [ "${KONG_BRANCH}" == "diablo-final" ]; then
KONG_BRANCH=master
fi
declare -A repomap
repomap=(
[stable]="http://ops.rcb.me/packages"
[unstable]="http://ops.monkeypuppetlabs.com/packages"
[experimental]="http://build.monkeypuppetlabs.com/packages"
)
if [ "${repomap[${PACKAGE_REPO-}]-}" = "" ]; then
die "No IP map set for ${PACKAGE_REPO} in $0"
fi
REPO=${repomap[${PACKAGE_REPO}]}
declare -A chefmap
chefmap=(
[diablo-d5]="https://github.com/rcbops/chef-cookbooks/raw/diablo/cookbooks-release-2011.3-d5.tgz"
[diablo-final]="https://raw.github.com/rcbops/chef-cookbooks/diablo/cookbooks.tgz"
)
CHEF_BRANCH=${NOVA_RELEASE}-${MILESTONE}
if [ "${chefmap[${CHEF_BRANCH-}]-}" = "" ]; then
die "No CHEF MAP set for CHEF_BRANCH ${CHEF_BRANCH} in $0"
fi
CHEF_URL=${chefmap[${CHEF_BRANCH}]}
function err_cleanup_chefsolo() {
# $1 - name
if [ "${NOCLEAN-0}" == "1" ]; then
exit 0
fi
# Diagnostic info
log "Running on $(hostname)"
log "Network:"
ssh root@${IP} -- /sbin/ifconfig
log "Kong conf"
ssh root@${IP} -- cat /opt/kong/etc/config.ini
log "Logs"
ssh root@${IP} -- tail -n100 /var/log/nova/nova*log
sudo virsh destroy ${1}
sleep 5
sudo lvremove -f ${LVM_ROOT}/${1}
exit 1
}
kvm_instance_name=${BINARY_BUILD_RELEASE}-${COMPONENT}-${PACKAGE_REPO}-AIO-test
# this sets IP as a side-effect
get_ip $kvm_instance_name
declare -a ip_octets
ip_octets=(${IP//./ })
MEMORY=2048000
maybe_make_kvm_instance $kvm_instance_name
trap "err_cleanup_chefsolo ${kvm_instance_name}" SIGINT SIGTERM ERR
start_kvm_instance $kvm_instance_name ${IP} ${REPO} ${BINARY_BUILD_RELEASE} ${COMPONENT}
cat > /tmp/${kvm_instance_name}.json <<EOF
{
"public": {
"label": "public",
"num_networks": "1",
"network_size": "255",
"bridge": "br100",
"bridge_dev": "eth0.100",
"dns1": "8.8.8.8",
"dns2": "8.8.4.4",
"ipv4_cidr": "10.2.${ip_octets[3]}.0/24"
},
"private": {
"label": "private",
"num_networks": "1",
"network_size": "255",
"bridge": "br101",
"bridge_dev": "eth0.101",
"dns1": "8.8.8.8",
"dns2": "8.8.4.4",
"ipv4_cidr": "10.3.${ip_octets[3]}.0/24"
},
"floating": {
"ipv4_cidr": "10.1.${ip_octets[3]}.0/24"
},
"kong": {
"branch": "${KONG_BRANCH}"
},
"image": {
"oneiric": "http://${IMAGE_CACHE}/ubuntu-11.10-server-uec-amd64-multinic.tar.gz",
"natty": "http://${IMAGE_CACHE}/ubuntu-11.04-server-uec-amd64-multinic.tar.gz",
"maverick": "http://${IMAGE_CACHE}/ubuntu-10.10-server-uec-amd64-multinic.tar.gz"
},
"package_url": "${REPO}",
"package_release": "${BINARY_BUILD_RELEASE}",
"package_component": "${COMPONENT}",
"virt_type": "qemu",
"run_list": [ "recipe[apt]", "recipe[openstack::allinone]", "recipe[kong]" ]
}
EOF
ssh root@${IP} apt-get install vlan -y --force-yes
ssh root@${IP} vconfig add eth0 100
ssh root@${IP} vconfig add eth0 101
run_chef_solo ${IP} ${CHEF_URL} /tmp/${kvm_instance_name}.json
sleep 20
## box should be configured now....
ssh root@${IP} "cd /opt/kong; ./run_tests.sh --version $COMPONENT --nova"
trap - SIGINT SIGTERM EXIT ERR
sudo virsh destroy ${kvm_instance_name}
sleep 5
sudo lvremove -f ${LVM_ROOT}/${kvm_instance_name}