commit eaacc5a0ce73252566997e4c71aedc0bd2e88328 Author: Enis Soztutar Date: Thu Jan 29 14:42:53 2015 -0800 HBASE-12944 Support patches to branches in precommit jenkins build diff --git dev-support/test-patch.properties dev-support/test-patch.properties index 4ecad34..2995f8e 100644 --- dev-support/test-patch.properties +++ dev-support/test-patch.properties @@ -24,3 +24,7 @@ OK_FINDBUGS_WARNINGS=95 OK_JAVADOC_WARNINGS=2 MAX_LINE_LENGTH=100 + +# All supported branches for testing with precommit build +# branch-1.x should apprear before branch-1 since the latter is a prefix +BRANCH_NAMES="0.94 0.98 branch-1.0 branch-1 master" diff --git dev-support/test-patch.sh dev-support/test-patch.sh index f99eefd..e1e6698 100755 --- dev-support/test-patch.sh +++ dev-support/test-patch.sh @@ -32,6 +32,7 @@ PROJECT_NAME=HBase JENKINS=false PATCH_DIR=/tmp BASEDIR=$(pwd) +BRANCH_NAME="master" PS=${PS:-ps} AWK=${AWK:-awk} @@ -200,10 +201,28 @@ checkout () { fi fi echo + else + if [[ $BRANCH_NAME -ne "master" ]]; then + echo "${GIT} checkout ${BRANCH_NAME}" + ${GIT} checkout ${BRANCH_NAME} + echo "${GIT} status" + ${GIT} status + fi fi return $? } +findBranchNameFromPatchName() { + local patchName=$1 + for LOCAL_BRANCH_NAME in $BRANCH_NAMES; do + if [[ $patchName =~ .*$LOCAL_BRANCH_NAME.* ]]; then + BRANCH_NAME=$LOCAL_BRANCH_NAME + break + fi + done + return 0 +} + ############################################################################### setup () { ### Download latest patch file (ignoring .htm and .html) when run from patch process @@ -227,9 +246,10 @@ setup () { echo "$patchURL" $WGET -q -O $PATCH_DIR/patch $patchURL VERSION=${GIT_COMMIT}_${defect}_PATCH-${patchNum} + findBranchNameFromPatchName ${relativePatchURL} JIRA_COMMENT="Here are the results of testing the latest attachment $patchURL - against master branch at commit ${GIT_COMMIT}. + against ${BRANCH_NAME} branch at commit ${GIT_COMMIT}. ATTACHMENT ID: ${ATTACHMENT_ID}" ### Copy the patch file to $PATCH_DIR