+if [[ ! -z "${CONTROLLERFEATURES}" ]]; then
+ ACTUALFEATURES="odl-integration-all,${CONTROLLERFEATURES}"
+else
+ ACTUALFEATURES="odl-integration-all"
+fi
-CONTROLLERMEM="3072m"
-ACTUALFEATURES="odl-integration-all"
-BUNDLEVERSION="$(xpath distribution/pom.xml '/project/version/text()' 2> /dev/null)"
-BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLEVERSION}"
-BUNDLE="${BUNDLEFOLDER}.zip"
-BUNDLE_PATH="/tmp/r/org/opendaylight/integration/${KARAF_ARTIFACT}/${BUNDLEVERSION}/${BUNDLE}"
+if [[ "${JOB_NAME}" == *"distribution-sanity"* ]]; then
+ CONTROLLERMEM="4096m"
+else
+ CONTROLLERMEM="3072m"
+fi
echo "Kill any controller running"
ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
echo "Clean Existing distribution"
rm -rf ${BUNDLEFOLDER}
-echo "Copying the distribution..."
-cp "${BUNDLE_PATH}" .
+echo "Fetch the distribution..."
+if [[ -z "${BUNDLE_PATH}" ]]; then
+ wget --progress=dot:mega "${ACTUAL_BUNDLE_URL}"
+else
+ cp "${BUNDLE_PATH}" .
+fi
echo "Extracting the new controller..."
unzip -q "${BUNDLE}"
echo "Configuring the startup features..."
FEATURESCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg"
-FEATURE_TEST_STRING="features-integration-test"
-if [[ "$KARAF_VERSION" == "karaf4" ]]; then
- FEATURE_TEST_STRING="features-test"
+FEATURE_TEST_STRING="features-test"
+if [[ "$KARAF_VERSION" == "karaf3" ]]; then
+ FEATURE_TEST_STRING="features-integration-test"
fi
-sed -ie "s%\(featuresRepositories=\|featuresRepositories =\)%featuresRepositories = mvn:org.opendaylight.integration/${FEATURE_TEST_STRING}/${BUNDLEVERSION}/xml/features,%g" ${FEATURESCONF}
+sed -ie "s%\(featuresRepositories= \|featuresRepositories = \)%featuresRepositories = mvn:org.opendaylight.integration/${FEATURE_TEST_STRING}/${BUNDLE_VERSION}/xml/features,%g" ${FEATURESCONF}
+
+if [[ ! -z "${REPO_URL}" ]]; then
+ # sed below will fail if it finds space between feature repos.
+ REPO_URL_NO_SPACE="$(echo -e "${REPO_URL}" | tr -d '[:space:]')"
+ sed -ie "s%featuresRepositories = %featuresRepositories = ${REPO_URL_NO_SPACE},%g" ${FEATURESCONF}
+fi
# Add actual boot features.
-sed -ie "s/\(featuresBoot=\|featuresBoot =\)/featuresBoot = ${ACTUALFEATURES},/g" "${FEATURESCONF}"
+# sed below will fail if it finds space between feature repos.
+FEATURES_NO_SPACE="$(echo -e "${ACTUALFEATURES}" | tr -d '[:space:]')"
+sed -ie "s/\(featuresBoot= \|featuresBoot = \)/featuresBoot = ${FEATURES_NO_SPACE},/g" "${FEATURESCONF}"
cat "${FEATURESCONF}"
echo "Configuring the log..."
echo "Listing all open ports on controller system"
netstat -pnatu
-echo "redirected karaf console output to karaf_console.log"
-export KARAF_REDIRECT="${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"
-mkdir -p ${WORKSPACE}/${BUNDLEFOLDER}/data/log
-
-if [ "${JDKVERSION}" == 'openjdk8' ]; then
+if [ "$JDKVERSION" == 'openjdk11' ]; then
+ echo "Preparing for JRE Version 11"
+ JAVA_HOME="/opt/jdk-11"
+elif [ "${JDKVERSION}" == 'openjdk8' ]; then
echo "Setting the JRE Version to 8"
# dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
# 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
echo "Starting controller..."
${WORKSPACE}/${BUNDLEFOLDER}/bin/start
-# No need for verbose printing during repeating operations.
-set +x
-
function dump_log_and_exit {
echo "Dumping first 500K bytes of karaf log..."
head --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"
exit 1
}
-echo "Waiting up to 5 minutes for controller to come up, checking every 5 seconds..."
-if [ "${DISTROSTREAM}" == "carbon" ] || [ "${DISTROSTREAM}" == "nitrogen" ]; then
- # Only oxygen and above have the infrautils.ready feature, so using REST API to determine if the controller is ready.
- COUNT="0"
- while true; do
- COUNT=$(( ${COUNT} + 5 ))
- sleep 5
- echo "already waited ${COUNT} seconds..."
- RESP="$(curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null || true)"
- echo ${RESP}
- if [[ ${RESP} == *"200"* ]]; then
- echo "Controller is UP"
- break
- elif (( "${COUNT}" > "300" )); then
- echo "Timeout Controller DOWN"
- dump_log_and_exit
- fi
- done
-else
- COUNT="0"
- while true; do
- COUNT=$(( ${COUNT} + 5 ))
- sleep 5
- echo "already waited ${COUNT} seconds..."
- if grep --quiet 'org.opendaylight.infrautils.ready-impl.*System ready' "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"; then
- echo "Controller is UP"
- break
- elif (( "${COUNT}" > "300" )); then
- echo "Timeout Controller DOWN"
- dump_log_and_exit
- fi
- done
-fi
-
-set -x
+echo "Waiting up to 6 minutes for controller to come up, checking every 5 seconds..."
+COUNT="0"
+while true; do
+ COUNT=$(( ${COUNT} + 5 ))
+ sleep 5
+ echo "already waited ${COUNT} seconds..."
+ if grep --quiet 'org.opendaylight.infrautils.*System ready' "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"; then
+ echo "Controller is UP"
+ break
+ elif (( "${COUNT}" >= "360" )); then
+ echo "Timeout Controller DOWN"
+ dump_log_and_exit
+ fi
+done
# echo "Checking OSGi bundles..."
# sshpass seems to fail with new karaf version
fi
}
+exit_on_log_file_message 'Error installing boot feature repository'
exit_on_log_file_message 'BindException: Address already in use'
exit_on_log_file_message 'server is unhealthy'