2 # TODO: Document the default values.
3 NEXUSURL_PREFIX="${ODLNEXUSPROXY:-https://nexus.opendaylight.org}"
4 ODL_NEXUS_REPO="${ODL_NEXUS_REPO:-content/repositories/opendaylight.snapshot}"
5 GERRIT_PATH="${GERRIT_PATH:-git.opendaylight.org/gerrit}"
6 DISTROBRANCH="${DISTROBRANCH:-$GERRIT_BRANCH}"
8 if [ "${BUNDLE_URL}" == 'last' ]; then
9 # Obtain current pom.xml of integration/distribution, correct branch.
10 if [[ "$KARAF_ARTIFACT" == "opendaylight" ]]; then
11 wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=opendaylight/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
12 elif [[ "$KARAF_ARTIFACT" == "karaf" ]]; then
13 wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
14 elif [[ "$KARAF_ARTIFACT" == "netconf-karaf" ]]; then
15 wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
16 elif [[ "$KARAF_ARTIFACT" == "controller-test-karaf" ]]; then
17 wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
18 elif [[ "$KARAF_ARTIFACT" == "bgpcep-karaf" ]]; then
19 wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=distribution-karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
21 wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
23 # Extract the BUNDLE_VERSION from the pom.xml
24 # TODO: remove the second xpath command once the old version in CentOS 7 is not used any more
25 BUNDLE_VERSION=$(xpath -e '/project/version/text()' pom.xml 2>/dev/null ||
26 xpath pom.xml '/project/version/text()' 2>/dev/null)
27 echo "Bundle version is ${BUNDLE_VERSION}"
28 # Acquire the timestamp information from maven-metadata.xml
29 NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/${KARAF_PROJECT}/${KARAF_ARTIFACT}"
30 wget "${NEXUSPATH}/${BUNDLE_VERSION}/maven-metadata.xml"
31 less "maven-metadata.xml"
32 # TODO: remove the second xpath command once the old version in CentOS 7 is not used any more
33 TIMESTAMP=$(xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" maven-metadata.xml 2>/dev/null ||
34 xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)
35 echo "Nexus timestamp is ${TIMESTAMP}"
36 BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}"
37 BUNDLE="${KARAF_ARTIFACT}-${TIMESTAMP}.zip"
38 ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLE_VERSION}/${BUNDLE}"
40 ACTUAL_BUNDLE_URL="${BUNDLE_URL}"
41 BUNDLE="${BUNDLE_URL##*/}"
42 ARTIFACT="$(basename "$(dirname "$(dirname "${BUNDLE_URL}")")")"
43 BUNDLE_VERSION="$(basename "$(dirname "${BUNDLE_URL}")")"
44 BUNDLEFOLDER="${ARTIFACT}-${BUNDLE_VERSION}"
47 echo "Distribution bundle URL is ${ACTUAL_BUNDLE_URL}"
48 echo "Distribution bundle is ${BUNDLE}"
49 echo "Distribution bundle version is ${BUNDLE_VERSION}"
50 echo "Distribution folder is ${BUNDLEFOLDER}"
51 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
53 # The following is not a shell file, double quotes would be literal.
54 cat > "${WORKSPACE}/detect_variables.env" <<EOF
55 ACTUAL_BUNDLE_URL=${ACTUAL_BUNDLE_URL}
57 BUNDLE_VERSION=${BUNDLE_VERSION}
58 BUNDLEFOLDER=${BUNDLEFOLDER}
59 NEXUSURL_PREFIX=${NEXUSURL_PREFIX}
62 # vim: ts=4 sw=4 sts=4 et ft=sh :