Newer
Older
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
#!/bin/bash
# Builds the software components, uploads them to sprint server
# and places a copy of them on the sprint server ready for installation.
if [ $# -lt 1 ]; then
echo "Usage: $0 <sprint number> [minor]"
exit 1
fi
TODAY=`date "+%Y-%m-%d"`
VER=$1
SUBVER=0
if [ $2 ]; then
SUBVER=$2
fi
FULL_VER=S$VER.$SUBVER
SPRINT_SERVER=sprint-openbis.ethz.ch
SPRINT_INSTALL_SCRIPT=sprint_install.sh
# Unset this to do a dry-run (like rsync -n) and set it to actually execute the commands
# unset EXECUTE_COMMANDS
EXECUTE_COMMANDS=1
function state_start {
echo "----------------------------------------------------------------------"
echo -n "| "
echo $1
echo ""
}
function state_end {
echo "\ -----------------------------------"
echo ""
}
function setup {
state_start Setup
echo "svn checkout svn+ssh://svncisd.ethz.ch/repos/cisd/build_resources/trunk build_resources"
if [ $EXECUTE_COMMANDS ]; then
svn checkout svn+ssh://svncisd.ethz.ch/repos/cisd/build_resources/trunk build_resources
fi
echo "cd build_resources"
if [ $EXECUTE_COMMANDS ]; then
cd build_resources
fi
state_end
}
function build {
state_start "Building openBIS..."
echo "./build.sh openbis_all $FULL_VER"
if [ $EXECUTE_COMMANDS ]; then
./build.sh openbis_all $FULL_VER
fi
state_end
}
function copy_to_cisd_server {
state_start "Copying new openBIS components to sprint-builds'..."
if [ $EXECUTE_COMMANDS ]; then
OPENBIS_PATH=~openbis/fileserver/sprint_builds/openBIS
SPRINT_DIR=$OPENBIS_PATH/$TODAY-$FULL_VER
mkdir -p $SPRINT_DIR
cp -p *.zip $SPRINT_DIR/
chmod g+w -R $SPRINT_DIR
fi
state_end
}
function copy_to_sprint_server {
state_start "Copying new openBIS components to '$SPRINT_SERVER'..."
if [ $EXECUTE_COMMANDS ]; then
scp openBIS-server-S*.zip $SPRINT_SERVER:.
scp datastore_server-S*.zip $SPRINT_SERVER:.
scp *.zip $SPRINT_SERVER:~/sprint_builds
rm -f *.zip
fi
state_end
}
function install_sprint {
# If sprint install script is present and executable, run it!
if [ $EXECUTE_COMMANDS ]; then
if [ -x $SPRINT_INSTALL_SCRIPT ]; then
state_start "Installing new sprint builds on '$SPRINT_SERVER'..."
echo Installing server remotely...
cat $SPRINT_INSTALL_SCRIPT | ssh -T $SPRINT_SERVER "cat > ~/$SPRINT_INSTALL_SCRIPT ; chmod 755 ~/$SPRINT_INSTALL_SCRIPT ; ~/$SPRINT_INSTALL_SCRIPT $VER ; rm -f ~/$SPRINT_INSTALL_SCRIPT"
state_end
fi
fi
}
if [ $EXECUTE_COMMANDS ]; then
echo -n
else
state_start "RUNNING DRY RUN"
fi
setup
build
copy_to_cisd_server
copy_to_sprint_server
install_sprint
state_start Done!