a4fa36cdaa5ffd2c00e77e83c5b89b5dd86a6a8c
[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_PLDISTROS=""
39 DEFAULT_FCDISTROS="f8"
40 DEFAULT_BITS="32 64"
41 #DEFAULT_TRUNK_DISTROS="onelab"
42 DEFAULT_TRUNK_DISTROS="onelab planetlab"
43 #DEFAULT_VS_PLDISTROS="onelab"
44 DEFAULT_VS_PLDISTROS=""
45 DEFAULT_BASE="@DATE@"
46
47 # export any of these to override - this is for manual use only
48 if [ -z "$PLDISTROS" ] ;        then PLDISTROS=$DEFAULT_PLDISTROS ;             else manual=true ; fi
49 if [ -z "$FCDISTROS" ] ;        then FCDISTROS=$DEFAULT_FCDISTROS ;             else manual=true ; fi
50 if [ -z "$BITS" ] ;             then BITS=$DEFAULT_BITS ;                       else manual=true ; fi
51 if [ -z "$TRUNK_DISTROS" ] ;    then TRUNK_DISTROS=$DEFAULT_TRUNK_DISTROS ;     else manual=true ; fi
52 if [ -z "$VS_PLDISTROS" ] ;     then VS_PLDISTROS=$DEFAULT_VS_PLDISTROS ;       else manual=true ; fi
53 if [ -z "$BASE" ] ;             then BASE=$DEFAULT_BASE ;                       else manual=true ; fi
54 [ -n "$RETRY" ] &&      { extra_option="$extra_option -o" ; manual=true ; }
55 [ -n "$TEST" ] &&       { extra_option="$extra_option -T" ; manual=true ; }
56 [ -n "$DRY_RUN" ] &&    { manual=true ; }
57
58 function run () {
59     [ -n "$manual" ] && echo "$@" '; \'
60     if [ -z "$DRY_RUN" ] ; then
61         "$@"
62     fi
63 }
64
65 function shortname () {
66     distro=$1; shift
67     case $distro in
68         onelab)         echo 1l;;
69         planetlab)      echo pl;;
70         *)              echo xx;;
71     esac
72 }
73
74 ############################## 4.2
75 for d in $PLDISTROS ; do
76     for f in $FCDISTROS ; do 
77         for bits in $BITS; do
78             p=linux${bits}
79             s=$(shortname $d)
80             buildname="${BASE}--${s}.4.2--${f}-${bits}"
81 #           buildname="${d}-4.2-rc3.1lab-${f}-${bits}"
82             command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
83                 -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
84                 -b $buildname $extra_option"
85             run $command
86         done
87     done
88 done
89
90 ############################## 4.2/centos5
91 # centos5 : for both archs, make the vserver rpms
92 # does not test, so skip if test is requested
93 if [ -z "$TEST" ] ; then
94     f=centos5
95     for d in $VS_PLDISTROS ; do
96         for bits in $BITS ; do
97             p=linux${bits}
98             s=$(shortname $d)
99             buildname="${BASE}--tr${s}-c5vs-${bits}"
100 #           buildname="${d}-4.2-rc3.1lab-${f}-${bits}"
101             command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
102             -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
103             -b $buildname -B vserver"
104             run $command
105         done
106     done
107 fi
108
109 ############################## TRUNK
110 # raw - std planetlab x f8 x 32bits for deploying on alpha nodes
111 for d in $TRUNK_DISTROS; do
112     for bits in $BITS; do
113         p=linux${bits}
114         s=$(shortname $d)
115         buildname="${BASE}--tr${s}-${bits}"
116         command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
117          -d $d -p $p -b $buildname $extra_option"
118         run $command
119     done
120 done
121
122 ##############################