641503ebabbcfaff5ef11ff4ad101106b87274ee
[releng/builder.git] / jjb / integration / include-raw-integration-get-bundle-vars.sh
1 echo "#################################################"
2 echo "##       Inject Global Variables               ##"
3 echo "#################################################"
4
5 NEXUSURL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
6
7 if [ ${BUNDLEURL} == 'last' ]; then
8     # Obtain current pom.xml of integration/distribution, correct branch.
9     wget "http://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$BRANCH" -O "pom.xml"
10     # Extract the BUNDLEVERSION from the pom.xml
11     BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
12     echo "Bundle version is ${BUNDLEVERSION}"
13     # Acquire the timestamp information from maven-metadata.xml
14     NEXUSPATH="${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf"
15     wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
16     less maven-metadata.xml
17     TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
18     echo "Nexus timestamp is ${TIMESTAMP}"
19     BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
20     BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
21     ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
22 else
23     ACTUALBUNDLEURL="${BUNDLEURL}"
24     BUNDLE="${BUNDLEURL##*/}"
25     BUNDLEVERSION="$(basename $(dirname $BUNDLEURL))"
26     BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
27 fi
28
29 echo "Distribution bundle URL is ${ACTUALBUNDLEURL}"
30 echo "Distribution bundle is ${BUNDLE}"
31 echo "Distribution bundle version is ${BUNDLEVERSION}"
32 echo "Distribution folder is ${BUNDLEFOLDER}"
33 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
34
35 cat > ${WORKSPACE}/bundle_vars.txt <<EOF
36 ACTUALBUNDLEURL=${ACTUALBUNDLEURL}
37 BUNDLE=${BUNDLE}
38 BUNDLEVERSION=${BUNDLEVERSION}
39 BUNDLEFOLDER=${BUNDLEFOLDER}
40 NEXUSURL_PREFIX=${NEXUSURL_PREFIX}
41 EOF
42
43 # vim: ts=4 sw=4 sts=4 et ft=sh :
44