1 NEXUSURL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
3 ACTUALFEATURES="odl-integration-compatible-with-all"
5 if [ ${BUNDLEURL} == 'last' ]; then
6 NEXUSPATH="${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf"
7 # Extract the BUNDLEVERSION from the pom.xml
8 BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
9 echo "Bundle version is ${BUNDLEVERSION}"
10 # Acquire the timestamp information from maven-metadata.xml
11 wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
12 TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
13 echo "Nexus timestamp is ${TIMESTAMP}"
14 BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
15 BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
16 ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
18 ACTUALBUNDLEURL="${BUNDLEURL}"
19 BUNDLE="${BUNDLEURL##*/}"
20 BUNDLEVERSION="$(basename $(dirname $BUNDLEURL))"
21 BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
24 echo "Distribution bundle URL is ${ACTUALBUNDLEURL}"
25 echo "Distribution bundle is ${BUNDLE}"
26 echo "Distribution bundle version is ${BUNDLEVERSION}"
27 echo "Distribution folder is ${BUNDLEFOLDER}"
28 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
30 echo "Downloading the distribution..."
31 wget --no-verbose ${ACTUALBUNDLEURL}
33 echo "Extracting the new controller..."
36 echo "Configuring the startup features..."
37 FEATURESCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
38 sed -ie "s%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-integration-test/${BUNDLEVERSION}/xml/features%g" ${FEATURESCONF}
41 echo "Configuring the log..."
42 LOGCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
43 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' ${LOGCONF}
46 echo "Configure the repos..."
47 REPOCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.url.mvn.cfg
48 sed -ie '/http/d' ${REPOCONF}
49 sed -ie '$s/...$//' ${REPOCONF}
52 echo "Configure max memory..."
53 MEMCONF=${WORKSPACE}/${BUNDLEFOLDER}/bin/setenv
54 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' ${MEMCONF}
57 echo "Starting controller..."
58 ${WORKSPACE}/${BUNDLEFOLDER}/bin/start
60 echo "sleeping for 10 seconds..."
63 echo "Check OSGi bundles..."
64 sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf "feature:install ${ACTUALFEATURES}" || echo $? > ${WORKSPACE}/error.txt
66 echo "Fetching Karaf log"
67 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log .
69 echo "Exit with error"
70 if [ `cat error.txt` -ne 0 ]; then
71 echo "Failed to deploy offline"
75 # vim: ts=4 sw=4 sts=4 et ft=sh :