X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Finclude-raw-integration-multipatch-distribution-test.sh;h=70aa31ace6cf62763cf4b35a031529fccba68c4c;hb=7923f5d31cc2331aa848f857b4d742f88a90fca7;hp=127fc43920d630ff50c993a68377c58d81f71ad7;hpb=39a1b318ac40cd86e14006ccc402db2fea58e6ac;p=releng%2Fbuilder.git diff --git a/jjb/integration/include-raw-integration-multipatch-distribution-test.sh b/jjb/integration/include-raw-integration-multipatch-distribution-test.sh old mode 100755 new mode 100644 index 127fc4392..70aa31ace --- a/jjb/integration/include-raw-integration-multipatch-distribution-test.sh +++ b/jjb/integration/include-raw-integration-multipatch-distribution-test.sh @@ -1,6 +1,15 @@ +# TODO: 1) clean up inline todo's below :) +# TODO: 2) Use just a topic branch to create a distribution. see this email: +# https://lists.opendaylight.org/pipermail/discuss/2015-December/006040.html +# TODO: 3) Bubble up CSIT jobs that are triggered by the multipatch job to a jenkins +# parameter. the default can be distribution-test which calls all CSIT jobs +# but being able to easily override it to a smaller subset (or none) will be +# helpful + # create a fresh empty place to build this custom distribution BUILD_DIR=${WORKSPACE}/patch_tester POM_FILE=${WORKSPACE}/patch_tester/pom.xml +DISTRIBUTION_BRANCH_TO_BUILD=$BRANCH #renaming variable for clarity rm -rf $BUILD_DIR mkdir -p $BUILD_DIR @@ -15,38 +24,68 @@ echo "4.0.0" >> $POM_FILE echo "pom" >> $POM_FILE echo "" >> $POM_FILE +# Set up git committer name and email, needed for commit creation when cherry-picking. +export EMAIL="sandbox@jenkins.opendaylight.org" +# TODO: Is there a more appropriate e-mail? +export GIT_COMMITTER_NAME="Multipatch Job" + +# TODO: Is "patches" still the correct word? IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}" -# for each patch, clone the project, and fetch/checkout the patch set. -# each patch is found in the ${PATCHES_TO_BUILD} variable as a comma -# separated list of project:changeset values -# Example: PATCHES_TO_BUILD=snmp:97/27997/1,tcpmd5:91/26391/3 +# For each patch, clone the project. +# Optionally checkout a specific patch set. +# Also optionally, cherry-pick series of patch sets. +# Each patch is found in the ${PATCHES_TO_BUILD} variable +# as a comma separated list of project[=checkout][:cherry-pick]* values # -# TODO: this version will not handle multiple patches from the same project and will be -# done at a later time. cherry-picking will be needed, with more complex logic -# TODO: Another enchancement will be to allow distribution patches. +# Example: PATCHES_TO_BUILD='odlparent=45/30045/2,yangtools:53/26853/25,mdsal,controller=61/29761/5:45/29645/6,bgpcep:39/30239/1:59/30059/2' # -for i in "${PATCHES[@]}" +distribution_status="not_included" +for patch_code in "${PATCHES[@]}" do - echo "working on ${i}" - PROJECT=`echo ${i} | cut -d\: -f 1` - PATCH=`echo ${i} | cut -d\: -f 2` - echo "${PROJECT}" >> $POM_FILE - echo "cloning ${PROJECT} and checking out ${PATCH}" - git clone https://git.opendaylight.org/gerrit/p/${PROJECT} - cd ${PROJECT} - git fetch https://git.opendaylight.org/gerrit/${PROJECT} refs/changes/${PATCH} - git checkout FETCH_HEAD - cd $BUILD_DIR - + echo "working on ${patch_code}" + PROJECT=`echo ${patch_code} | cut -d\: -f 1 | cut -d\= -f 1` + if [ "${PROJECT}" == "integration/distribution" ]; then + distribution_status="included" + fi + PROJECT_SHORTNAME="${PROJECT##*/}" # http://stackoverflow.com/a/3162500 + echo "cloning project ${PROJECT}" + git clone "https://git.opendaylight.org/gerrit/p/${PROJECT}" + echo "${PROJECT_SHORTNAME}" >> ${POM_FILE} + cd ${PROJECT_SHORTNAME} + CHECKOUT=`echo ${patch_code} | cut -d\= -s -f 2 | cut -d\: -f 1` + if [ "x${CHECKOUT}" != "x" ]; then + echo "checking out ${CHECKOUT}" + git fetch "https://git.opendaylight.org/gerrit/${PROJECT}" "refs/changes/$CHECKOUT" + git checkout FETCH_HEAD + else + echo "checking out ${DISTRIBUTION_BRANCH_TO_BUILD}" + git checkout "${DISTRIBUTION_BRANCH_TO_BUILD}" + fi + PICK_SEGMENT=`echo "${patch_code}" | cut -d\: -s -f 2-` + IFS=':' read -ra PICKS <<< "${PICK_SEGMENT}" + for pick in "${PICKS[@]}" + do + echo "cherry-picking ${pick}" + git fetch "https://git.opendaylight.org/gerrit/${PROJECT}" "refs/changes/${pick}" + git cherry-pick --ff --keep-redundant-commits FETCH_HEAD + done + cd "${BUILD_DIR}" done -# clone distribution and add it as a module in root pom -git clone https://git.opendaylight.org/gerrit/p/integration/distribution +if [ "${distribution_status}" == "not_included" ]; then + echo "adding integration/distribution" + # clone distribution and add it as a module in root pom + git clone "https://git.opendaylight.org/gerrit/p/integration/distribution" + cd distribution + git checkout "${DISTRIBUTION_BRANCH_TO_BUILD}" + cd "${BUILD_DIR}" + echo "distribution" >> ${POM_FILE} +fi -echo "distribution" >> $POM_FILE -echo "" >> $POM_FILE -echo "" >> $POM_FILE +# finish pom file +echo "" >> ${POM_FILE} +echo "" >> ${POM_FILE} # Extract the BUNDLEVERSION from the distribution pom.xml BUNDLEVERSION=`xpath $BUILD_DIR/distribution/pom.xml '/project/version/text()' 2> /dev/null` @@ -57,4 +96,4 @@ echo "Bundle url is ${BUNDLEURL}" # Set BUNDLEVERSION & BUNDLEURL echo BUNDLEVERSION=${BUNDLEVERSION} > ${WORKSPACE}/bundle.txt -echo BUNDLEURL=${BUNDLEURL} >> ${WORKSPACE}/bundle.txt \ No newline at end of file +echo BUNDLEURL=${BUNDLEURL} >> ${WORKSPACE}/bundle.txt