forked from lantz/build-scripts
-
Notifications
You must be signed in to change notification settings - Fork 4
/
nightly.sh
executable file
·78 lines (64 loc) · 1.97 KB
/
nightly.sh
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
#!/bin/bash
# We don't set -e because some of the commands may
# fail or exit with non-zero return codes.
# BL note: the actual cron job is another script which
# runs this one and posts its output to Jenkins
echo '* Simple Mininet Nightly Build Script'
date=`date +%Y-%m-%d-%a`
builddir=/build
dir=$builddir/nightly-$date
mndir=${HOME}/mininet
build=${mndir}/util/vm/build.py
opts='-z --timeout 1800'
scripts=/home/mininet/build-scripts
post=$scripts/post-build-result.sh
check=$scripts/check-build-dir.sh
examples=$scripts/test-built-vm.sh
maxbuilds=3
echo '* Pulling latest build.py'
pushd $mndir
git pull --rebase
popd
# If we have a bunch of builds, remove the oldest first
cd $builddir
while [ `ls -td nightly-* | wc -l` -gt $maxbuilds ]; do
oldest=`ls -td nightly-* | tail -1`
echo "* Removing old build directory $oldest"
sudo rm -rf $oldest
done
# Create new nightly build directory
mkdir $dir
cd $dir
# Build current master branch
dists="precise saucy trusty utopic"
archs="32 64"
for dist in $dists; do
for arch in $archs ; do
target="${dist}${arch}server"
echo "* Building $target and posting to jenkins"
$post "mininet-$target" $build $opts $target
builddir=mn-$target*
echo "* Checking build log for $builddir"
$post "check-$target" $check $builddir
echo "* Testing examples (quick)"
$post "test-examples-$target" $examples $date $target examplesquick
done
done
# Build stable release
release=2.1.0p2
dists="trusty"
opts="$opts -b $release"
for dist in $dists; do
for arch in $archs; do
target="${dist}${arch}server"
echo "* Building $target and posting to jenkins"
$post "mininet-$release-$target" $build $opts $target
builddir=mn-$release-$target*
echo "* Checking build log for $builddir"
$post "check-$release-$target" $check $builddir
echo "* Testing examples (quick)"
$post "test-examples-$release-$target" $examples $date $target examplesquick
done
done
echo '* Nightly Build Script complete'
exit 0