X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fdistribution%2Fdistribution-check-bootup.sh;h=7547109446da8185e9d404c8004a05d6d322e546;hb=8677c241183102bfef87c119de295c13fb2782e1;hp=d4ffea9cdd3bcff8939ddbbbdddb799aa92269f9;hpb=bacdb8e9b58cc4738e84e29cf265a5242e8021ed;p=releng%2Fbuilder.git diff --git a/jjb/integration/distribution/distribution-check-bootup.sh b/jjb/integration/distribution/distribution-check-bootup.sh index d4ffea9cd..754710944 100644 --- a/jjb/integration/distribution/distribution-check-bootup.sh +++ b/jjb/integration/distribution/distribution-check-bootup.sh @@ -1,10 +1,9 @@ - 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 [[ ! -z "${CONTROLLERFEATURES}" ]]; then + ACTUALFEATURES="odl-integration-all,${CONTROLLERFEATURES}" +fi echo "Kill any controller running" ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh @@ -12,18 +11,29 @@ 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" -# Add test feature repo if Karaf 4. -sed -ie "s%mvn:org.opendaylight.integration/features-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-test/${BUNDLEVERSION}/xml/features%g" "${FEATURESCONF}" -# Add test feature repo if Karaf 3. -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}" +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}/${BUNDLE_VERSION}/xml/features,%g" ${FEATURESCONF} + +if [[ ! -z "${REPO_URL}" ]]; then + sed -ie "s%featuresRepositories =%featuresRepositories = ${REPO_URL},%g" ${FEATURESCONF} +fi + # Add actual boot features. sed -ie "s/\(featuresBoot=\|featuresBoot =\)/featuresBoot = ${ACTUALFEATURES},/g" "${FEATURESCONF}" cat "${FEATURESCONF}" @@ -41,9 +51,6 @@ cat "${MEMCONF}" 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" - if [ "${JDKVERSION}" == 'openjdk8' ]; then echo "Setting the JRE Version to 8" # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start. @@ -61,51 +68,36 @@ java -version echo "Redirecting karaf console output to karaf_console.log" export KARAF_REDIRECT="${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" +mkdir -p ${WORKSPACE}/${BUNDLEFOLDER}/data/log echo "Starting controller..." ${WORKSPACE}/${BUNDLEFOLDER}/bin/start -# No need for verbose printing during repeating operations. -set +x - -echo "Waiting for controller to come up..." -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 || true)" - echo "${RESP}" - if [[ "${RESP}" == *"200"* ]]; then - echo Controller is UP - break - elif (( "${COUNT}" > 600 )); then - echo Timeout Controller DOWN - echo "Dumping Karaf log..." - cat "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" - echo "Listing all open ports on controller system" - netstat -pnatu - exit 1 - else - COUNT=$(( ${COUNT} + 1 )) - sleep 1 - if [[ $(($COUNT % 5)) == 0 ]]; then - echo already waited ${COUNT} seconds... - fi - fi -done +function dump_log_and_exit { + echo "Dumping first 500K bytes of karaf log..." + head --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Dumping last 500K bytes of karaf log..." + tail --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" + cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" . + cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" . + exit 1 +} -echo "loading many features at once. Need to allow time for problems to show up in logs. cool down for 5 min ..." -COUNT="300" +echo "Waiting up to 5 minutes for controller to come up, checking every 5 seconds..." +COUNT="0" while true; do - if (( "${COUNT}" <= "0" )); then + 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 - echo "${COUNT} seconds yet to wait..." - sleep 10 - COUNT="$(( ${COUNT} - 10 ))" done -# End of repeating operations, enable verbose printing. -set -x - # echo "Checking OSGi bundles..." # sshpass seems to fail with new karaf version # sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list' @@ -117,28 +109,17 @@ function exit_on_log_file_message { echo "looking for \"$1\" in karaf.log file" if grep --quiet "$1" "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"; then echo ABORTING: found "$1" - echo "Dumping first 500K bytes of karaf log..." - head --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" - echo "Dumping last 500K bytes of karaf log..." - tail --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" - cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" . - cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" . - exit 1 + dump_log_and_exit fi echo "looking for \"$1\" in karaf_console.log file" if grep --quiet "$1" "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"; then echo ABORTING: found "$1" - echo "Dumping first 500K bytes of karaf log..." - head --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" - echo "Dumping last 500K bytes of karaf log..." - tail --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" - cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" . - cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" . - exit 1 + dump_log_and_exit 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' @@ -151,9 +132,9 @@ echo "Kill controller" ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh echo "Bug 4628: Detecting misplaced config files" -pushd "${WORKSPACE}/${BUNDLEFOLDER}" +pushd "${WORKSPACE}/${BUNDLEFOLDER}" || exit XMLS_FOUND="$(echo *.xml)" -popd +popd || exit if [ "$XMLS_FOUND" != "*.xml" ]; then echo "Bug 4628 confirmed." ## TODO: Uncomment the following when ODL is fixed, to guard against regression.