4fe62587504c36e4714c0cc142d2c9a5a09c68a2
[infrastructure.git] / scripts / all-builds.sh
1 #!/bin/bash
2 # this script is managed under subversion at 
3 # http://svn.one-lab.org/infrastructure/scripts/all-builds.sh
4 # it is triggered every night at 0:05 french time on build.one-lab.org aka blitz.inria.fr
5
6 COMMAND=$(basename $0)
7
8 function usage () {
9     echo "Usage: $COMMAND"
10     echo "In manual mode you should export the following vars (or use related option)"
11     echo "PLDISTROS (-d) FCDISTROS (-f) BITS (-i) TRUNK_DISTROS (-td) VS_PLDISTROS (-vd)"
12     echo "BASE (-b) RETRY (-O) TEST (-T) DRY_RUN (-n)"
13     echo "Use at least one space for blanking a set of distros"
14     exit 1
15 }
16
17 while [[ -n "$@" ]] ; do
18     case "$1" in
19         -d) shift ; PLDISTROS="$PLDISTROS $1" ;;
20         -f) shift ; FCDISTROS="$FCDISTROS $1" ;;
21         -i) shift ; BITS="$BITS $1" ;;
22         -td) shift; TRUNK_DISTROS="$1" ;;
23         -vd) shift; VS_PLDISTROS="$1" ;;
24         -b) shift; BASE="$1" ;;
25         -O) RETRY=true ;;
26         -T) TEST=true ;;
27         -n) DRY_RUN=true ;;
28         *) usage ;;
29     esac
30     shift
31 done
32
33 [[ -n "$@" ]] && usage
34
35 # tuned for allowing manual re-runs, mostly for tests
36
37 DEFAULT_PLDISTROS="planetlab onelab"
38 DEFAULT_FCDISTROS="f8"
39 DEFAULT_BITS="32 64"
40 #DEFAULT_TRUNK_DISTROS="onelab"
41 DEFAULT_TRUNK_DISTROS="onelab planetlab"
42 DEFAULT_VS_PLDISTROS="onelab"
43 DEFAULT_BASE="@DATE@"
44
45 # export any of these to override - this is for manual use only
46 if [ -z "$PLDISTROS" ] ;        then PLDISTROS=$DEFAULT_PLDISTROS ;             else manual=true ; fi
47 if [ -z "$FCDISTROS" ] ;        then FCDISTROS=$DEFAULT_FCDISTROS ;             else manual=true ; fi
48 if [ -z "$BITS" ] ;             then BITS=$DEFAULT_BITS ;                       else manual=true ; fi
49 if [ -z "$TRUNK_DISTROS" ] ;    then TRUNK_DISTROS=$DEFAULT_TRUNK_DISTROS ;     else manual=true ; fi
50 if [ -z "$VS_PLDISTROS" ] ;     then VS_PLDISTROS=$DEFAULT_VS_PLDISTROS ;       else manual=true ; fi
51 if [ -z "$BASE" ] ;             then BASE=$DEFAULT_BASE ;                       else manual=true ; fi
52 [ -n "$RETRY" ] &&      { extra_option="$extra_option -o" ; manual=true ; }
53 [ -n "$TEST" ] &&       { extra_option="$extra_option -T" ; manual=true ; }
54 [ -n "$DRY_RUN" ] &&    { manual=true ; }
55
56 function run () {
57     [ -n "$manual" ] && echo "$@" '; \'
58     if [ -z "$DRY_RUN" ] ; then
59         "$@"
60     fi
61 }
62
63 function shortname () {
64     distro=$1; shift
65     case $distro in
66         onelab)         echo 1l;;
67         planetlab)      echo pl;;
68         *)              echo xx;;
69     esac
70 }
71
72 ############################## 4.2
73 for d in $PLDISTROS ; do
74     for f in $FCDISTROS ; do 
75         for bits in $BITS; do
76             p=linux${bits}
77             s=$(shortname $d)
78             buildname="${BASE}--${s}.4.2--${f}-${bits}"
79 #           buildname="${d}-4.2-rc2.1lab-${f}-${bits}"
80             command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
81                 -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
82                 -b $buildname $extra_option"
83             run $command
84         done
85     done
86 done
87
88 ############################## 4.2/centos5
89 # centos5 : for both archs, make the vserver rpms
90 # does not test, so skip if test is requested
91 if [ -z "$TEST" ] ; then
92     f=centos5
93     for d in $VS_PLDISTROS ; do
94         for bits in $BITS ; do
95             p=linux${bits}
96             s=$(shortname $d)
97             buildname="${BASE}--tr${s}-c5vs-${bits}"
98 #           buildname="${d}-4.2-rc2.1lab-${f}-${bits}"
99             command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
100             -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
101             -b $buildname -B vserver"
102             run $command
103         done
104     done
105 fi
106
107 ############################## TRUNK
108 # raw - std planetlab x f8 x 32bits for deploying on alpha nodes
109 for d in $TRUNK_DISTROS; do
110     for bits in $BITS; do
111         p=linux${bits}
112         s=$(shortname $d)
113         buildname="${BASE}--tr${s}-${bits}"
114         command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
115          -d $d -p $p -b $buildname $extra_option"
116         run $command
117     done
118 done
119
120 ##############################