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"
13 wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
15 # Extract the BUNDLE_VERSION from the pom.xml
16 BUNDLE_VERSION="$(xpath pom.xml '/project/version/text()' 2> /dev/null)"
17 echo "Bundle version is ${BUNDLE_VERSION}"
18 # Acquire the timestamp information from maven-metadata.xml
19 NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/${KARAF_ARTIFACT}"
20 wget "${NEXUSPATH}/${BUNDLE_VERSION}/maven-metadata.xml"
21 less "maven-metadata.xml"
22 TIMESTAMP="$(xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)"
23 echo "Nexus timestamp is ${TIMESTAMP}"
24 BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}"
25 BUNDLE="${KARAF_ARTIFACT}-${TIMESTAMP}.zip"
26 ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLE_VERSION}/${BUNDLE}"
28 ACTUAL_BUNDLE_URL="${BUNDLE_URL}"
29 BUNDLE="${BUNDLE_URL##*/}"
30 ARTIFACT="$(basename "$(dirname "$(dirname "${BUNDLE_URL}")")")"
31 BUNDLE_VERSION="$(basename "$(dirname "${BUNDLE_URL}")")"
32 BUNDLEFOLDER="${ARTIFACT}-${BUNDLE_VERSION}"
35 echo "Distribution bundle URL is ${ACTUAL_BUNDLE_URL}"
36 echo "Distribution bundle is ${BUNDLE}"
37 echo "Distribution bundle version is ${BUNDLE_VERSION}"
38 echo "Distribution folder is ${BUNDLEFOLDER}"
39 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
41 # The following is not a shell file, double quotes would be literal.
42 cat > "${WORKSPACE}/detect_variables.env" <<EOF
43 ACTUAL_BUNDLE_URL=${ACTUAL_BUNDLE_URL}
45 BUNDLE_VERSION=${BUNDLE_VERSION}
46 BUNDLEFOLDER=${BUNDLEFOLDER}
47 NEXUSURL_PREFIX=${NEXUSURL_PREFIX}
50 # vim: ts=4 sw=4 sts=4 et ft=sh :