-
Notifications
You must be signed in to change notification settings - Fork 16
/
jenkins-update-fedora
executable file
·55 lines (42 loc) · 1.15 KB
/
jenkins-update-fedora
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
#!/bin/bash
#
# $1 = test repo number
#
# force a local default so this can be run on command line
DISTRELEASE=fedora-beefy
[ -e $(dirname $0)/jenkins-deb-common ] || exit 1
. $(dirname $0)/jenkins-deb-common
jenkins_init
jenkins_set_vars
kvm_instance_name=fedora-beefy-update
# this sets IP as a side-effect
get_ip $kvm_instance_name
function err_cleanup() {
# $1 - name
if [ "${NOCLEAN-0}" == "1" ]; then
exit 0
fi
sudo virsh destroy ${1}
sleep 5
sudo lvremove -f ${LVM_ROOT}/${1}
exit 1
}
MEMORY=2048000
maybe_make_kvm_instance $kvm_instance_name
trap "err_cleanup ${kvm_instance_name}" SIGINT SIGTERM ERR
start_kvm_instance $kvm_instance_name ${IP} http://archive.ubuntu.com/ubuntu precise main
# update packages
ssh root@${IP} yum -y --exclude=kernel* update
ssh root@${IP} yum -y install vconfig perl gcc make yum-fastestmirror redhat-lsb
sleep 1s
ssh root@${IP} sync
sleep 1s
ssh root@${IP} sync
sleep 1s
ssh root@${IP} sync
sleep 20s
trap - SIGINT SIGTERM EXIT ERR
sudo virsh destroy ${kvm_instance_name}
sleep 5
# here we merge the snapshot back into the original
sudo lvconvert --merge ${LVM_ROOT}/${kvm_instance_name}