Add distribution diff collection between newly created distribution and latest on... 80/51580/6
authorJamo Luhrsen <jluhrsen@redhat.com>
Wed, 8 Feb 2017 00:32:49 +0000 (16:32 -0800)
committerJamo Luhrsen <jluhrsen@redhat.com>
Fri, 10 Feb 2017 03:25:26 +0000 (19:25 -0800)
Change-Id: Ic785538490bef15d92434723b798515cbb731306
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
jjb/integration/distribution-jobs.yaml
jjb/integration/include-raw-integration-compare-distributions.sh [new file with mode: 0644]
jjb/integration/include-raw-integration-get-bundle-vars.sh
jjb/integration/integration-macros.yaml

index da71d2d61f53ab269398e2b66a7cc6facd8cbdee..56fe08930f39d6df257382d293729835beaaa5f9 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'
                 settings-type: cfp
                 global-settings: 'odl-global-settings'
                 global-settings-type: cfp
+        - integration-compare-distributions
+        # TODO: the output of the above command is not *friendly* for the reader because the most important info
+        # is listed last. This is fine/best for command line output, but for keeping in a file it would be better
+        # to put the summary at the beginning of the file. Some bash magic can be done here to make that happen.
 
     reporters:
         - findbugs
diff --git a/jjb/integration/include-raw-integration-compare-distributions.sh b/jjb/integration/include-raw-integration-compare-distributions.sh
new file mode 100644 (file)
index 0000000..05a8e1a
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Depends on variables created and published from the get-bundle-vars script
+
+# Do not fail the build if there is trouble trying to collect distribution patch diffs
+set +e
+
+wget --progress=dot:mega $ACTUALBUNDLEURL
+echo "Extracting the last distribution found on nexus..."
+unzip -q $BUNDLE
+mv $BUNDLEFOLDER /tmp/distro_old
+
+echo "Extracting the distribution just created by this job..."
+NEW_DISTRO=$(find $WORKSPACE -name distribution-karaf*.zip)
+NEW_DISTRO_BASENAME=$(basename $NEW_DISTRO)
+cp $NEW_DISTRO /tmp/
+cd /tmp/
+# the following extracts the .zip and learns the name of the folder extracted to
+EXTRACTED_FOLDER=$(unzip $NEW_DISTRO_BASENAME | grep -m1 'creating:' | cut -d' ' -f5-)
+mv $EXTRACTED_FOLDER distro_new
+
+git clone https://git.opendaylight.org/gerrit/p/integration/test.git
+cd test/tools/distchanges
+mkdir -p $WORKSPACE/archives
+
+python distcompare.py -r ssh://jenkins-$SILO@git.opendaylight.org:29418 | tee $WORKSPACE/archives/dist_diff.txt
+# TODO: the output of the above command is not *friendly* for the reader because the most important info
+# is listed last. This is fine/best for command line output, but for keeping in a file it would be better
+# to put the summary at the beginning of the file. Some bash magic can be done here to make that happen.
index eb070e5111838f557aa7560500ae895c0f454203..dcdf3aebb772c909d56b38d1cdb386f946848b95 100644 (file)
@@ -5,6 +5,7 @@ echo "#################################################"
 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}
+BRANCH=${GERRIT_BRANCH:-BRANCH}
 
 if [ ${BUNDLEURL} == 'last' ]; then
     # Obtain current pom.xml of integration/distribution, correct branch.
index a0e480942467e85bc8e2973eabfb5705fc473830..b045df66832f8d9fbcef261d118409af1525f950 100644 (file)
             !include-raw:
                 - include-raw-integration-replace-block-text.sh
 
+# Macro: integration-compare-distributions
+# Operation: will compare an already created distribtion (probably last
+# published to nexus) to the current distribution being created.
+# The comparison is done to find the list of patches that are new to the
+# current distribtion.
+# Used by: builder-merge job template
+#
+# This script requires the bundle vars that are created by the
+# get-bundle-vars macro script
+
+
+- builder:
+    name: integration-compare-distributions
+    builders:
+        - shell:
+            !include-raw:
+                - include-raw-integration-compare-distributions.sh
+
 ##############
 # Publishers #
 ##############