Handle bundle-vars directly in dist-compare script 19/54619/3
authorJamo Luhrsen <jluhrsen@redhat.com>
Mon, 10 Apr 2017 20:24:03 +0000 (13:24 -0700)
committerJamo Luhrsen <jluhrsen@redhat.com>
Tue, 11 Apr 2017 18:23:27 +0000 (11:23 -0700)
instead of using the get-bundle-vars script as a build step
which can fail when there is really no "last" build (like
when cutting a new branch) we can figure out those variables
directly in the compare-distribution script which is using
set +e. If there is any trouble with the compare-distribution
script, we don't abort the build.

Change-Id: I8442149ae4c0f3ddb3f69b73dbac5df3c948a4b8
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
jjb/integration/distribution-jobs.yaml
jjb/integration/include-raw-integration-compare-distributions.sh

index 4a62e56b995d94310c82ce6d7d115faf47c6ca92..3e837ff42023b229f13c4f463af7e156d04b714d 100644 (file)
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts} **/dependency_tree.txt **/*.hprof **/target/surefire-reports/*-output.txt'
-      - integration-bundleurl:
-          bundleurl: 'last'
     scm:
       - gerrit-trigger-scm:
           refspec: ''
     prebuilders:
       - wipe-org-opendaylight-repo
       - jacoco-nojava-workaround
-      - integration-get-bundle-vars
-      - inject:
-          properties-file: 'bundle_vars.txt'
       - provide-maven-settings:
           global-settings-file: 'odl-global-settings'
           settings-file: 'integration-settings'
index ae172ad368ae3a452f72661455fe39092506a36b..ecd77675f6d7159bc0b57d801921191173d2d29c 100644 (file)
@@ -5,6 +5,32 @@
 # Do not fail the build if there is trouble trying to collect distribution patch diffs
 set +e
 
+NEXUSURL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
+ODL_NEXUS_REPO=${ODL_NEXUS_REPO:-content/repositories/opendaylight.snapshot}
+GERRIT_PATH=${GERRIT_PATH:-git.opendaylight.org/gerrit}
+DISTROBRANCH=${DISTROBRANCH:-$GERRIT_BRANCH}
+
+# Obtain current pom.xml of integration/distribution, correct branch.
+wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+# Extract the BUNDLEVERSION from the pom.xml
+BUNDLEVERSION=$(xpath pom.xml '/project/version/text()' 2> /dev/null)
+echo "Bundle version is ${BUNDLEVERSION}"
+# Acquire the timestamp information from maven-metadata.xml
+NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/distribution-karaf"
+wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
+
+if [ $? -ne 0 ]; then
+  echo "unable to find maven-metadata.xml. no need to continue..."
+  exit 0
+fi
+
+less maven-metadata.xml
+TIMESTAMP=$(xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)
+echo "Nexus timestamp is ${TIMESTAMP}"
+BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
+BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
+ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
+
 wget --progress=dot:mega $ACTUALBUNDLEURL
 echo "Extracting the last distribution found on nexus..."
 unzip -q $BUNDLE