Save infra resources
[releng/builder.git] / jjb / integration / integration-detect-variables.sh
index 542b0dcc1eac95dfd097cf2c68a0ef78328f5cbe..66e2df0d004c42426f923dec0f0fff18c8e03eef 100644 (file)
@@ -7,7 +7,11 @@ DISTROBRANCH="${DISTROBRANCH:-$GERRIT_BRANCH}"
 
 if [ ${BUNDLE_URL} == 'last' ]; then
     # Obtain current pom.xml of integration/distribution, correct branch.
-    wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+    if [[ "$KARAF_ARTIFACT" == "opendaylight" ]]; then
+        wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=opendaylight/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+    else
+        wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+    fi
     # Extract the BUNDLE_VERSION from the pom.xml
     BUNDLE_VERSION="$(xpath pom.xml '/project/version/text()' 2> /dev/null)"
     echo "Bundle version is ${BUNDLE_VERSION}"
@@ -20,7 +24,15 @@ if [ ${BUNDLE_URL} == 'last' ]; then
     BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}"
     BUNDLE="${KARAF_ARTIFACT}-${TIMESTAMP}.zip"
     ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLE_VERSION}/${BUNDLE}"
+elif [ ${BUNDLE_URL} == 'autorelease' ]; then
+    # Use latest stable AR job distribution URL
+    ACTUAL_BUNDLE_URL="$(curl -sL -X GET -H 'Accept:text/plain' https://jenkins.opendaylight.org/releng/view/autorelease/job/autorelease-release-$DISTROSTREAM/lastStableBuild/injectedEnvVars/export | grep BUNDLE_URL | tr -d 'BUNDLE_URL=')"
+    BUNDLE="${ACTUAL_BUNDLE_URL##*/}"
+    ARTIFACT="$(basename "$(dirname "$(dirname "${ACTUAL_BUNDLE_URL}")")")"
+    BUNDLE_VERSION="$(basename "$(dirname "${ACTUAL_BUNDLE_URL}")")"
+    BUNDLEFOLDER="${ARTIFACT}-${BUNDLE_VERSION}"
 else
+    # Use provided BUNDLE_URL
     ACTUAL_BUNDLE_URL="${BUNDLE_URL}"
     BUNDLE="${BUNDLE_URL##*/}"
     ARTIFACT="$(basename "$(dirname "$(dirname "${BUNDLE_URL}")")")"