Adding job to detect if distribution can work offline 38/16938/1
authorLuis Gomez <ecelgp@gmail.com>
Sat, 21 Mar 2015 01:57:21 +0000 (18:57 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Sat, 21 Mar 2015 01:57:21 +0000 (18:57 -0700)
Change-Id: Ib395051d79de764700e988f6bff58122f0a1257c
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
jjb/integration/include-raw-integration-deploy-controller-offline.sh [new file with mode: 0644]
jjb/integration/integration-jobs.yaml
jjb/integration/integration-macros.yaml

diff --git a/jjb/integration/include-raw-integration-deploy-controller-offline.sh b/jjb/integration/include-raw-integration-deploy-controller-offline.sh
new file mode 100644 (file)
index 0000000..6e0e4d6
--- /dev/null
@@ -0,0 +1,77 @@
+# Create a script to run controller inside a dynamic jenkins slave
+DISTRIBUTION="karaf"
+CONTROLLERFEATURES="odl-integration-compatible-with-all"
+CONTROLLERMEM="3072m"
+
+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}"
+    echo "Distribution bundle URL is ${BUNDLEURL}"
+else
+    BUNDLE="$(echo "$BUNDLEURL" | awk -F '/' '{ print $(NF) }')"
+    BUNDLEFOLDER="${BUNDLE//.zip}"
+fi
+
+echo "Downloading the distribution from ${BUNDLEURL}"
+wget --no-verbose  ${BUNDLEURL}
+
+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}
+
+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}
+
+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}
+
+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}
+
+echo "Starting controller..."
+./start &
+
+echo "sleeping for 20 seconds..."
+sleep 20
+
+echo "Check OSGi bundles..."
+./client "feature:install ${CONTROLLERFEATURES}" || echo $? > ${WORKSPACE}/error.txt
+
+echo "Fetching Karaf log"
+cd ${WORKSPACE}
+cp ${BUNDLEFOLDER}/data/log/karaf.log .
+
+echo "Exit with error"
+if [ `cat error.txt` -ne 0 ]; then
+    echo "Failed to deploy offline"
+    exit 1
+fi
+
+# vim: ts=4 sw=4 sts=4 et ft=sh :
+
index 469c9bc75d5554c2ba1d620fadb19d1f49670cad..08062cd51abf794420aca686fe23f97529ca344e 100644 (file)
@@ -6,6 +6,7 @@
         - 'integration-distribution-verify-{stream}'
         - 'integration-distribution-merge-{stream}'
         - 'integration-csit-verify-{stream}'
+        - 'integration-distribution-offline-{stream}'
 
     # stream:    branch with - in place of / (eg. stable-helium)
     # branch:    branch (eg. stable/helium)
         - email-notification:
             email-prefix: '[{project}]'
 
+- job-template:
+    name: 'integration-distribution-offline-{stream}'
+
+    project-type: freestyle
+    node: dynamic_controller
+
+    logrotate:
+        daysToKeep: '{build-days-to-keep}'
+        numToKeep: '{build-num-to-keep}'
+        artifactDaysToKeep: '{build-artifact-days-to-keep}'
+        artifactNumToKeep: '{build-artifact-num-to-keep}'
+
+    parameters:
+        - project-parameter:
+            project: 'integration'
+        - integration-branch:
+            branch: '{branch}'
+        - integration-bundleurl:
+            bundleurl: 'last'
+
+    scm:
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            refspec: ''
+            branch: '{branch}'
+
+    wrappers:
+        - build-timeout
+        - ssh-agent-credentials:
+            user: '{ssh-credentials}'
+
+    triggers:
+        - timed: 'H H * * *'
+
+    builders:
+        - integration-deploy-controller-offline
+
+    publishers:
+        - archive:
+            artifacts: 'karaf.log'
+        - email-notification:
+            email-prefix: '[{project}]'
+
index 8724e6eda0b30d6e30d2169226e5a16b37ba9556..2ed9dc5c1a2058ea510b01546ab875c3ff1e6737 100644 (file)
         - shell:
             !include-raw include-raw-integration-deploy-controller-run-test.sh
 
+- builder:
+    name: integration-deploy-controller-offline
+    builders:
+        - shell:
+            !include-raw include-raw-integration-deploy-controller-offline.sh
+
 ##############
 # Publishers #
 ##############