X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fintegration-compare-distributions.sh;h=87ad52100927df5cef44ad2c5e9b2f6e0283d0eb;hb=HEAD;hp=a7b3827eca45d9ab885ec38e73b80ac4713d3500;hpb=81cfc7674e3fa164696c9b3e2cb62e8be3bf164d;p=releng%2Fbuilder.git diff --git a/jjb/integration/integration-compare-distributions.sh b/jjb/integration/integration-compare-distributions.sh index a7b3827ec..dc694a1eb 100644 --- a/jjb/integration/integration-compare-distributions.sh +++ b/jjb/integration/integration-compare-distributions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # Depends on variables created and published from the integration-set-variables script @@ -11,48 +11,76 @@ 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}" +if [[ "$KARAF_ARTIFACT" == "opendaylight" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=opendaylight/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +elif [[ "$KARAF_ARTIFACT" == "karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +elif [[ "$KARAF_ARTIFACT" == "netconf-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +elif [[ "$KARAF_ARTIFACT" == "controller-test-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +elif [[ "$KARAF_ARTIFACT" == "bgpcep-karaf" ]]; then + wget "http://${GERRIT_PATH}/gitweb?p=${KARAF_PROJECT}.git;a=blob_plain;f=distribution-karaf/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +else + wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml" +fi + +# Extract the BUNDLE_VERSION from the pom.xml +# TODO: remove the second xpath command once the old version in CentOS 7 is not used any more +BUNDLE_VERSION=$(xpath -e '/project/version/text()' pom.xml 2>/dev/null || + xpath pom.xml '/project/version/text()' 2>/dev/null) +echo "Bundle version is ${BUNDLE_VERSION}" # Acquire the timestamp information from maven-metadata.xml -NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/${KARAF_ARTIFACT}" -wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml +NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/${KARAF_PROJECT}/${KARAF_ARTIFACT}" +wget "${NEXUSPATH}/${BUNDLE_VERSION}/maven-metadata.xml" +# shellcheck disable=SC2181 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) +# TODO: remove the second xpath command once the old version in CentOS 7 is not used any more +TIMESTAMP=$(xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" maven-metadata.xml 2>/dev/null || + xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null) echo "Nexus timestamp is ${TIMESTAMP}" -BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLEVERSION}" +BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}" BUNDLE="${KARAF_ARTIFACT}-${TIMESTAMP}.zip" -ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}" +ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLE_VERSION}/${BUNDLE}" -wget --progress=dot:mega $ACTUAL_BUNDLE_URL +wget --progress=dot:mega "$ACTUAL_BUNDLE_URL" echo "Extracting the last distribution found on nexus..." -unzip -q $BUNDLE -mv $BUNDLEFOLDER /tmp/distro_old -rm $BUNDLE +unzip -q "$BUNDLE" +mv "$BUNDLEFOLDER" /tmp/distro_old +rm "$BUNDLE" echo "Extracting the distribution just created by this job..." -NEW_DISTRO="$(find $WORKSPACE -name "${KARAF_ARTIFACT}*.zip")" +NEW_DISTRO="$(find "$WORKSPACE" -name "${KARAF_ARTIFACT}*.zip")" NEW_DISTRO_BASENAME="$(basename "$NEW_DISTRO")" -cp $NEW_DISTRO /tmp/ +cp "$NEW_DISTRO" /tmp/ cd /tmp/ || exit -# get the name of the folder which will be extracted to -EXTRACTED_FOLDER=$(unzip $NEW_DISTRO_BASENAME | grep 'creating:' | grep -v '/.' | cut -d' ' -f5-) -mv $EXTRACTED_FOLDER distro_new +unzip "$NEW_DISTRO_BASENAME" +mv "$BUNDLEFOLDER" distro_new -git clone https://git.opendaylight.org/gerrit/p/integration/test.git +git clone https://git.opendaylight.org/gerrit/integration/test.git cd test/tools/distchanges || exit -mkdir -p $WORKSPACE/archives +mkdir -p "$WORKSPACE"/archives # Full output of compare tool will be in temp file /tmp/dist_diff.txt # The file/report to be archived will only list the distribution in the comparison and the patches that # are different. -python distcompare.py -r ssh://jenkins-$SILO@git.opendaylight.org:29418 | tee /tmp/dist_diff.txt -echo -e "Patch differences listed are in comparison to:\n\t$ACTUAL_BUNDLE_URL\n\n" > $WORKSPACE/archives/distribution_differences.txt -sed -ne '/Patch differences/,$ p' /tmp/dist_diff.txt >> $WORKSPACE/archives/distribution_differences.txt +python distcompare.py -r "ssh://jenkins-$SILO@git.opendaylight.org:29418" | tee /tmp/dist_diff.txt +echo -e "Patch differences listed are in comparison to:\n\t$ACTUAL_BUNDLE_URL\n\n" > "$WORKSPACE"/archives/distribution_differences.txt +sed -ne '/Patch differences/,$ p' /tmp/dist_diff.txt >> "$WORKSPACE"/archives/distribution_differences.txt + +# Check OpenDaylight YANG modules: +echo "Installing pyang" +pip install --user pyang +if [ -f /tmp/distro_new/bin/extract_modules.sh ]; then + echo "Extracting YANG modules" + /tmp/distro_new/bin/extract_modules.sh + echo "Checking YANG modules" + /tmp/distro_new/bin/check_modules.sh + mv /tmp/distro_new/opendaylight-models "$WORKSPACE"/archives +fi