X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Finclude-raw-integration-deploy-controller-offline.sh;h=57117c7e5790ae0dd2f26aecab057d9cd5c13b89;hb=c7321202e8b0d5f17234a0e4ebbdeaba253dec7c;hp=077c56ed5779f7575b68ed5204048e3325bcb9e9;hpb=68b1cf2ed3c3cae0dea9af546653a1dc8b452587;p=releng%2Fbuilder.git diff --git a/jjb/integration/include-raw-integration-deploy-controller-offline.sh b/jjb/integration/include-raw-integration-deploy-controller-offline.sh index 077c56ed5..57117c7e5 100644 --- a/jjb/integration/include-raw-integration-deploy-controller-offline.sh +++ b/jjb/integration/include-raw-integration-deploy-controller-offline.sh @@ -1,80 +1,76 @@ -# Create a script to run controller inside a dynamic jenkins slave -DISTRIBUTION="karaf" -CONTROLLERFEATURES="odl-integration-compatible-with-all" CONTROLLERMEM="3072m" +ACTUALFEATURES="odl-integration-all" -if [ ${BUNDLEURL} == 'last' ]; then - NEXUSPATH="https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-${DISTRIBUTION}" - # Extract the BUNDLEVERSION from the pom.xml - BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null` - echo "Bundle version is ${BUNDLEVERSION}" - # Acquire the timestamp information from maven-metadata.xml - wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml - TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null` - echo "Nexus timestamp is ${TIMESTAMP}" - BUNDLEFOLDER="distribution-${DISTRIBUTION}-${BUNDLEVERSION}" - BUNDLE="distribution-${DISTRIBUTION}-${TIMESTAMP}.zip" - BUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}" -else - BUNDLE="$(echo ${BUNDLEURL} | awk -F '/' '{ print $(NF) }')" - echo "Finding out Bundle folder..." - wget --no-verbose ${BUNDLEURL} - BUNDLEFOLDER="$(unzip -qql ${BUNDLE} | head -n1 | tr -s ' ' | cut -d' ' -f5- | rev | cut -c 2- | rev)" - rm ${BUNDLE} -fi +echo "Kill any controller running" +ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh -echo "Distribution bundle URL is ${BUNDLEURL}" -echo "Distribution bundle is ${BUNDLE}" -echo "Distribution folder is ${BUNDLEFOLDER}" +echo "Clean workspace" +rm -rf * -echo "Downloading the distribution from ${BUNDLEURL}" -wget --no-verbose ${BUNDLEURL} +echo "Downloading the distribution..." +wget --no-verbose ${ACTUALBUNDLEURL} + +if [ ${JDKVERSION} == 'openjdk8' ]; then + echo "Setting the JDK Version to 8" + sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.60-2.b27.el7_1.x86_64/jre/bin/java + export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.60-2.b27.el7_1.x86_64 + java -version +fi +if [ ${JDKVERSION} == 'openjdk7' ]; then + echo "Setting the JDK Version to 7" + sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1.x86_64/jre/bin/java + export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1.x86_64 + java -version +fi echo "Extracting the new controller..." unzip -q ${BUNDLE} echo "Configuring the startup features..." -cd ${BUNDLEFOLDER}/etc -CFG=org.apache.karaf.features.cfg -cp ${CFG} ${CFG}.bak -cat ${CFG}.bak | sed "s/^featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${CONTROLLERFEATURES}/" > ${CFG}.1 -cat ${CFG}.1 | sed "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%" > ${CFG} -cat ${CFG} +FEATURESCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg +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} +cat ${FEATURESCONF} echo "Configuring the log..." -LOG=org.ops4j.pax.logging.cfg -cp ${LOG} ${LOG}.bak -cat ${LOG}.bak | sed 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/' > ${LOG} -cat ${LOG} +LOGCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg +sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' ${LOGCONF} +# FIXME: Make log size limit configurable from build parameter. +sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=100GB/g' ${LOGCONF} +cat ${LOGCONF} echo "Configure the repos..." -REPO=org.ops4j.pax.url.mvn.cfg -cp ${REPO} ${REPO}.bak -cat ${REPO}.bak | sed '/http/d' | sed '$s/...$//'> ${REPO} -cat ${REPO} +REPOCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.url.mvn.cfg +sed -ie '/http/d' ${REPOCONF} +sed -ie '$s/...$//' ${REPOCONF} +cat ${REPOCONF} echo "Configure max memory..." -MEM=setenv -cd ../bin -cp ${MEM} ${MEM}.bak -cat ${MEM}.bak | sed 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/' > ${MEM} -cat ${MEM} +MEMCONF=${WORKSPACE}/${BUNDLEFOLDER}/bin/setenv +sed -ie "s/2048m/${CONTROLLERMEM}/g" ${MEMCONF} +cat ${MEMCONF} + +echo "JDK Version ..." +java -version echo "Starting controller..." -./start & +${WORKSPACE}/${BUNDLEFOLDER}/bin/start -echo "sleeping for 20 seconds..." -sleep 20 +echo "sleeping for 10 seconds..." +sleep 10 -echo "Check OSGi bundles..." -./client "feature:install ${CONTROLLERFEATURES}" || echo $? > ${WORKSPACE}/error.txt +echo "Installing all features..." +sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf "feature:install ${ACTUALFEATURES}" || echo $? > ${WORKSPACE}/error.txt -echo "Fetching Karaf log" -cd ${WORKSPACE} -cp ${BUNDLEFOLDER}/data/log/karaf.log . +echo "Killing ODL and fetching Karaf log..." +head --bytes=1M "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" > "karaf.log" +# TODO: Do we want different name for karaf.log chunk to signal it may be not complete? +ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh +sleep 5 +xz -9ekvv "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" +mv "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log.xz" . echo "Exit with error" -if [ `cat error.txt` -ne 0 ]; then +if [ -f ${WORKSPACE}/error.txt ]; then echo "Failed to deploy offline" exit 1 fi