Create JJB for vpnservice with dependencies on
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-controller-min.sh
1 # Create a script to run controller inside a dynamic jenkins slave
2 cat > ${WORKSPACE}/controller-script.sh <<EOF
3 # redefine our TMP space
4 export TMP=/tmp/jenkins-integration-controller
5 pidfile="\${TMP}/opendaylight.PID"
6
7 # create our new tmp space (we do it here in case we recently just finished cleaning)
8 mkdir -p \${TMP}
9
10 # download the artifact
11 cd /tmp
12 wget --no-verbose ${BUNDLEURL}
13
14 # extract the new controller
15 cd \${TMP}
16 BUNDLE="$(echo "$BUNDLEURL" | awk -F '/' '{ print $(NF) }')"
17 BUNDLEFOLDER="\${BUNDLE//.zip}"
18 unzip -q /tmp/\${BUNDLE}
19
20 # Configure the controller
21 cd \${BUNDLEFOLDER}/etc
22 # Configure the startup features
23 export CFG=org.apache.karaf.features.cfg
24 cp \${CFG} \${CFG}.bak
25 cat \${CFG}.bak | sed 's/^featuresBoot=.*/featuresBoot=${CONTROLLER_FEATURES}/' > \${CFG}
26 # Configure the log
27 export LOG=org.ops4j.pax.logging.cfg
28 cp \${LOG} \${LOG}.bak
29 cat \${LOG}.bak | sed 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/' > \${LOG}
30
31 # run the controller but trick jenkins into not killing it
32 cd ../bin
33 BUILD_ID=dontKillMe ./start
34
35 # sleep for 300 seconds may need to be longer
36 sleep 150
37
38 # Check OSGi bundles
39 ./client 'bundle:list'
40
41 # Getting ODL PID to store in common file
42 cd ../instances
43 ODLPID=\`grep pid instance.properties | awk -F ' ' '{print \$3}'\`
44 echo \${ODLPID}
45 ps -p \${ODLPID}
46 echo \${ODLPID} > \${pidfile}
47
48 ls \${TMP}
49 EOF
50
51 scp ${WORKSPACE}/controller-script.sh $CONTROLLER0:/tmp
52 ssh $CONTROLLER0 'bash /tmp/controller-script.sh'
53
54 # vim: ts=4 sw=4 sts=4 et ft=sh :