Recognize openjdk17 in integration scripts
[releng/builder.git] / jjb / integration / distribution / distribution-check-bootup.sh
index 0cd69a969ff69afc6f09ebbcf49cfa6769ba919d..f10c09a56ef3dc5a9777098d63a338f34cef9edc 100644 (file)
@@ -1,8 +1,13 @@
 #!/bin/bash
-if [[ -n "${CONTROLLERFEATURES}" ]]; then
-    ACTUALFEATURES="odl-integration-all,${CONTROLLERFEATURES}"
+# do not add integration features in MRI projects
+if [[ "$KARAF_PROJECT" == integration ]]; then
+    if [[ -n "${CONTROLLERFEATURES}" ]]; then
+        ACTUALFEATURES="odl-integration-all,${CONTROLLERFEATURES}"
+    else
+        ACTUALFEATURES="odl-integration-all"
+    fi
 else
-    ACTUALFEATURES="odl-integration-all"
+    ACTUALFEATURES="${CONTROLLERFEATURES}"
 fi
 
 if [[ "${JOB_NAME}" == *"distribution-sanity"* ]]; then
@@ -31,23 +36,28 @@ unzip -q "${BUNDLE}"
 echo "Configuring the startup features..."
 FEATURESCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg"
 FEATURE_TEST_STRING="features-test"
-if [[ "$KARAF_VERSION" == "karaf3" ]]; then
-    FEATURE_TEST_STRING="features-integration-test"
+FEATURE_TEST_VERSION="$BUNDLE_VERSION"
+if [[ "$KARAF_ARTIFACT" == "opendaylight" ]]; then
+    FEATURE_TEST_VERSION="$(sed -r "s%^([0-9]+)\.([0-9]+)\.0(.*)%0.\1.\2\3%" <<<"$BUNDLE_VERSION")"
 fi
 
-sed -ie "s%\(featuresRepositories= \|featuresRepositories = \)%featuresRepositories = mvn:org.opendaylight.integration/${FEATURE_TEST_STRING}//xml/features,%g" "${FEATURESCONF}"
+# only replace feature repo in integration/distro, MRI projects need to pull in
+# the features they need by themselves
+if [[ "$KARAF_PROJECT" == integration ]]; then
+    sed -ie "s%\(featuresRepositories= \|featuresRepositories = \)%featuresRepositories = mvn:org.opendaylight.integration/${FEATURE_TEST_STRING}/${FEATURE_TEST_VERSION}/xml/features,%g" "${FEATURESCONF}"
 
-if [[ -n "${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
+    if [[ -n "${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 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}"
+    # Add actual boot features.
+    # 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}"
+fi
 
 echo "Configuring the log..."
 LOGCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg"
@@ -62,7 +72,10 @@ cat "${MEMCONF}"
 echo "Listing all open ports on controller system"
 netstat -pnatu
 
-if [ "$JDKVERSION" == 'openjdk11' ]; then
+if [ "$JDKVERSION" == 'openjdk17' ]; then
+    echo "Preparing for JRE Version 17"
+    JAVA_HOME="/usr/lib/jvm/java-17-openjdk"
+elif [ "$JDKVERSION" == 'openjdk11' ]; then
     echo "Preparing for JRE Version 11"
     JAVA_HOME="/usr/lib/jvm/java-11-openjdk"
 elif [ "${JDKVERSION}" == 'openjdk8' ]; then