Merge "move nexus repository to parameter with default value"
[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 ODL_NEXUS_REPO=${ODL_NEXUS_REPO:-content/repositories/opendaylight.snapshot}
7
8 if [ ${BUNDLEURL} == 'last' ]; then
9     # Obtain current pom.xml of integration/distribution, correct branch.
10     wget "http://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$BRANCH" -O "pom.xml"
11     # Extract the BUNDLEVERSION from the pom.xml
12     BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
13     echo "Bundle version is ${BUNDLEVERSION}"
14     # Acquire the timestamp information from maven-metadata.xml
15     NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/distribution-karaf"
16     wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
17     less maven-metadata.xml
18     TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
19     echo "Nexus timestamp is ${TIMESTAMP}"
20     BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
21     BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
22     ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
23 else
24     ACTUALBUNDLEURL="${BUNDLEURL}"
25     BUNDLE="${BUNDLEURL##*/}"
26     BUNDLEVERSION="$(basename $(dirname $BUNDLEURL))"
27     BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
28 fi
29
30 if [ ${JDKVERSION} == 'openjdk8' ]; then
31     echo "Preparing for JRE Version 8"
32     JAVA_HOME="/usr/lib/jvm/java-1.8.0"
33 elif [ ${JDKVERSION} == 'openjdk7' ]; then
34     echo "Preparing for JRE Version 7"
35     JAVA_HOME="/usr/lib/jvm/java-1.7.0"
36 fi
37
38 echo "Distribution bundle URL is ${ACTUALBUNDLEURL}"
39 echo "Distribution bundle is ${BUNDLE}"
40 echo "Distribution bundle version is ${BUNDLEVERSION}"
41 echo "Distribution folder is ${BUNDLEFOLDER}"
42 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
43 echo "Java home is ${JAVA_HOME}"
44
45 cat > ${WORKSPACE}/bundle_vars.txt <<EOF
46 ACTUALBUNDLEURL=${ACTUALBUNDLEURL}
47 BUNDLE=${BUNDLE}
48 BUNDLEVERSION=${BUNDLEVERSION}
49 BUNDLEFOLDER=${BUNDLEFOLDER}
50 NEXUSURL_PREFIX=${NEXUSURL_PREFIX}
51 JAVA_HOME=${JAVA_HOME}
52 EOF
53
54 # vim: ts=4 sw=4 sts=4 et ft=sh :
55