Rework the way Java version is set in CSIT jobs
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-controller.sh
index 4b04c867e530144898aa88f2be4fef9772a15d79..d9ac4da92cc3f31963efb585c3164bfb7ae4c475 100644 (file)
 echo "#################################################"
-echo "##   include-raw-integration-deploy-controller ##"
+echo "##       Install Distribution in Cluster       ##"
 echo "#################################################"
 
-set -x
+CONTROLLERMEM="2048m"
 
+if [ ${CONTROLLERSCOPE} == 'all' ]; then
+    ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
+    CONTROLLERMEM="3072m"
+else
+    ACTUALFEATURES="${CONTROLLERFEATURES}"
+fi
+# Some versions of jenkins job builder result in feature list containing spaces
+# and ending in newline. Remove all that.
+ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'`
 
 cat > ${WORKSPACE}/deploy-controller-script.sh <<EOF
-echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
+
+echo "Changing to /tmp"
 cd /tmp
-wget --no-verbose  ${ACTUALBUNDLEURL}
+
+echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
+wget --no-verbose  '${ACTUALBUNDLEURL}'
 
 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,${CONTROLLERFEAT}/" > \${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=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
+sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
+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=/tmp/${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 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 deploy controller..."
-./start
+MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
+sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
+cat \${MEMCONF}
 
 EOF
 
-cat > ${WORKSPACE}/deploy-sanitytest-controller-script.sh <<EOF
-set -x
-
-echo "Waiting for controller to come up..."
-cd /tmp
-cd ${BUNDLEFOLDER}/bin
-
-COUNT="0"
-
-
-while true; do
-    RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
-    echo \$RESP
-    if [[ \$RESP == *"200"* ]]; then
-        echo Controller is UP
-        break
-    elif (( "\$COUNT" > "600" )); then
-        echo Timeout Controller DOWN
-
-        cd /tmp/${BUNDLEFOLDER}/data/
-        cat karaf.log
-        exit 1
-    else
-        COUNT=\$(( \${COUNT} + 5 ))
-        sleep 5
-        echo waiting \$COUNT secs...
-    fi
-done
-
-
-cd /tmp/${BUNDLEFOLDER}/bin/
-
-echo "Checking OSGi bundles..."
-sshpass -p karaf ./client -u karaf 'bundle:list'
-
-pkill java
-
-set +x
-
-EOF
-
-
-set +x
-
-
-
-
-###############################################################
-##  Define a function to run controller-script on controller  #
-###############################################################
-
-function runcontrollerscript
-{
-  local CONTROLLERIP=$1
-  echo "running controller $CONTROLLERIP"
-  scp ${WORKSPACE}/deploy-controller-script.sh $CONTROLLERIP:/tmp
-  ssh $CONTROLLERIP 'bash /tmp/deploy-controller-script.sh'
-}
-
-function sanitytestcontroller
-{
-  local CONTROLLERIP=$1
-  echo "sanity testing controller $CONTROLLERIP"
-  scp ${WORKSPACE}/deploy-sanitytest-controller-script.sh $CONTROLLERIP:/tmp
-  ssh $CONTROLLERIP 'bash /tmp/deploy-sanitytest-controller-script.sh'
-}
-
-echo "##################################"
-echo "##  Loop through controller IPs  #"
-echo "##################################"
-
-declare CONTROLLERIPS=($(cat slave_addresses.txt | grep CONTROLLER | awk -F = '{print $2}'))
-
-for  i in "${CONTROLLERIPS[@]}"
-do
-   echo "IP address is: $i"
-   runcontrollerscript $i
-done
-
-for  i in "${CONTROLLERIPS[@]}"
+for i in `seq 1 ${NUM_ODL_SYSTEM}`
 do
-   echo "IP address is: $i"
-   sanitytestcontroller $i
+    CONTROLLERIP=ODL_SYSTEM_${i}_IP 
+    echo "Installing distribution in member-${i} with IP address ${!CONTROLLERIP}"
+    scp ${WORKSPACE}/deploy-controller-script.sh ${!CONTROLLERIP}:/tmp
+    ssh ${!CONTROLLERIP} 'bash /tmp/deploy-controller-script.sh'
 done
 
-echo "###################################################"
-echo "## END include-raw-integration-deploy-controller ##"
-echo "###################################################"
-
 # vim: ts=4 sw=4 sts=4 et ft=sh :
-