Merge "BUG-2625: enable JDK8 verification for reservation"
[releng/builder.git] / jjb / integration / include-raw-integration-multipatch-distribution-test.sh
1 # create a fresh empty place to build this custom distribution
2 BUILD_DIR=${WORKSPACE}/patch_tester
3 POM_FILE=${WORKSPACE}/patch_tester/pom.xml
4
5 rm -rf $BUILD_DIR
6 mkdir -p $BUILD_DIR
7 cd $BUILD_DIR
8
9 # create a root pom that will contain a module for each project we have a patch for
10 echo "<project>" >> $POM_FILE
11 echo "<groupId>org.opendaylight.test</groupId>" >> $POM_FILE
12 echo "<artifactId>test</artifactId>" >> $POM_FILE
13 echo "<version>0.1</version>" >> $POM_FILE
14 echo "<modelVersion>4.0.0</modelVersion>" >> $POM_FILE
15 echo "<packaging>pom</packaging>" >> $POM_FILE
16 echo "<modules>" >> $POM_FILE
17
18 IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}"
19
20 # for each patch, clone the project, and fetch/checkout the patch set.
21 # each patch is found in the ${PATCHES_TO_BUILD} variable as a comma
22 # separated list of project:changeset values
23 # Example:  PATCHES_TO_BUILD=snmp:97/27997/1,tcpmd5:91/26391/3
24 #
25 # TODO: this version will not handle multiple patches from the same project and will be
26 #       done at a later time.  cherry-picking will be needed, with more complex logic
27 # TODO: Another enchancement will be to allow distribution patches.
28 #
29 for i in "${PATCHES[@]}"
30 do
31     echo "working on ${i}"
32     PROJECT=`echo ${i} | cut -d\: -f 1`
33     PATCH=`echo ${i} | cut -d\: -f 2`
34     echo "<module>${PROJECT}</module>" >> $POM_FILE
35     echo "cloning ${PROJECT} and checking out ${PATCH}"
36     git clone https://git.opendaylight.org/gerrit/p/${PROJECT}
37     cd ${PROJECT}
38     git fetch https://git.opendaylight.org/gerrit/${PROJECT} refs/changes/${PATCH}
39     git checkout FETCH_HEAD
40     cd $BUILD_DIR
41
42 done
43
44 # clone distribution and add it as a module in root pom
45 git clone https://git.opendaylight.org/gerrit/p/integration/distribution
46
47 echo "<module>distribution</module>" >> $POM_FILE
48 echo "</modules>" >> $POM_FILE
49 echo "</project>" >> $POM_FILE
50
51 # Extract the BUNDLEVERSION from the distribution pom.xml
52 BUNDLEVERSION=`xpath $BUILD_DIR/distribution/pom.xml '/project/version/text()' 2> /dev/null`
53 echo "Bundle version is ${BUNDLEVERSION}"
54
55 BUNDLEURL=${BUILD_URL}org.opendaylight.integration\$distribution-karaf/artifact/org.opendaylight.integration/distribution-karaf/${BUNDLEVERSION}/distribution-karaf-${BUNDLEVERSION}.zip
56 echo "Bundle url is ${BUNDLEURL}"
57
58 # Set BUNDLEVERSION & BUNDLEURL
59 echo BUNDLEVERSION=${BUNDLEVERSION} > ${WORKSPACE}/bundle.txt
60 echo BUNDLEURL=${BUNDLEURL} >> ${WORKSPACE}/bundle.txt