X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fintegration-detect-variables.sh;h=925192c07ec5e32cf83c76b46e8ef6515e1ef4f5;hb=fe057c97485074953ea037537bd2adf3332dc4bd;hp=66e2df0d004c42426f923dec0f0fff18c8e03eef;hpb=fa39e8f8dd2a6c820abfb33ece6252eddb348c16;p=releng%2Fbuilder.git diff --git a/jjb/integration/integration-detect-variables.sh b/jjb/integration/integration-detect-variables.sh index 66e2df0d0..925192c07 100644 --- a/jjb/integration/integration-detect-variables.sh +++ b/jjb/integration/integration-detect-variables.sh @@ -1,38 +1,42 @@ - +#!/bin/bash # TODO: Document the default values. NEXUSURL_PREFIX="${ODLNEXUSPROXY:-https://nexus.opendaylight.org}" ODL_NEXUS_REPO="${ODL_NEXUS_REPO:-content/repositories/opendaylight.snapshot}" GERRIT_PATH="${GERRIT_PATH:-git.opendaylight.org/gerrit}" DISTROBRANCH="${DISTROBRANCH:-$GERRIT_BRANCH}" -if [ ${BUNDLE_URL} == 'last' ]; then +if [ "${BUNDLE_URL}" == 'last' ]; then # Obtain current pom.xml of integration/distribution, correct branch. 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" + elif [[ "$KARAF_ARTIFACT" == "karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" + elif [[ "$KARAF_ARTIFACT" == "netconf-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" + elif [[ "$KARAF_ARTIFACT" == "controller-test-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" + elif [[ "$KARAF_ARTIFACT" == "bgpcep-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=distribution-karaf/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)" + # TODO: remove the second xpath command once the old version in CentOS 7 is not used any more + BUNDLE_VERSION=$(xpath -e '/project/version/text()' pom.xml 2>/dev/null || + xpath pom.xml '/project/version/text()' 2>/dev/null) echo "Bundle version is ${BUNDLE_VERSION}" # Acquire the timestamp information from maven-metadata.xml - NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/${KARAF_ARTIFACT}" + NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/${KARAF_PROJECT}/${KARAF_ARTIFACT}" wget "${NEXUSPATH}/${BUNDLE_VERSION}/maven-metadata.xml" less "maven-metadata.xml" - TIMESTAMP="$(xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)" + # TODO: remove the second xpath command once the old version in CentOS 7 is not used any more + TIMESTAMP=$(xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" maven-metadata.xml 2>/dev/null || + xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null) echo "Nexus timestamp is ${TIMESTAMP}" 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}")")")"