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"
7 # create our new tmp space (we do it here in case we recently just finished cleaning)
10 # download the artifact
12 wget --no-verbose ${BUNDLEURL}
14 # extract the new controller
16 BUNDLE="$(echo "$BUNDLEURL" | awk -F '/' '{ print $(NF) }')"
17 BUNDLEFOLDER="\${BUNDLE//.zip}"
18 unzip -q /tmp/\${BUNDLE}
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}
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}
31 # run the controller but trick jenkins into not killing it
33 BUILD_ID=dontKillMe ./start
35 # sleep for 300 seconds may need to be longer
39 ./client 'bundle:list'
41 # Getting ODL PID to store in common file
43 ODLPID=\`grep pid instance.properties | awk -F ' ' '{print \$3}'\`
46 echo \${ODLPID} > \${pidfile}
51 scp ${WORKSPACE}/controller-script.sh $CONTROLLER0:/tmp
52 ssh $CONTROLLER0 'bash /tmp/controller-script.sh'
54 # vim: ts=4 sw=4 sts=4 et ft=sh :