HBASE-12944 Support patches to branches in precommit jenkins build

This commit is contained in:
Enis Soztutar 2015-01-29 14:42:53 -08:00
parent 9c37d5dab7
commit eaacc5a0ce
2 changed files with 25 additions and 1 deletions

View File

@ -24,3 +24,7 @@ OK_FINDBUGS_WARNINGS=95
OK_JAVADOC_WARNINGS=2 OK_JAVADOC_WARNINGS=2
MAX_LINE_LENGTH=100 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"

View File

@ -32,6 +32,7 @@ PROJECT_NAME=HBase
JENKINS=false JENKINS=false
PATCH_DIR=/tmp PATCH_DIR=/tmp
BASEDIR=$(pwd) BASEDIR=$(pwd)
BRANCH_NAME="master"
PS=${PS:-ps} PS=${PS:-ps}
AWK=${AWK:-awk} AWK=${AWK:-awk}
@ -200,10 +201,28 @@ checkout () {
fi fi
fi fi
echo echo
else
if [[ $BRANCH_NAME -ne "master" ]]; then
echo "${GIT} checkout ${BRANCH_NAME}"
${GIT} checkout ${BRANCH_NAME}
echo "${GIT} status"
${GIT} status
fi
fi fi
return $? 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 () { setup () {
### Download latest patch file (ignoring .htm and .html) when run from patch process ### Download latest patch file (ignoring .htm and .html) when run from patch process
@ -227,9 +246,10 @@ setup () {
echo "$patchURL" echo "$patchURL"
$WGET -q -O $PATCH_DIR/patch $patchURL $WGET -q -O $PATCH_DIR/patch $patchURL
VERSION=${GIT_COMMIT}_${defect}_PATCH-${patchNum} VERSION=${GIT_COMMIT}_${defect}_PATCH-${patchNum}
findBranchNameFromPatchName ${relativePatchURL}
JIRA_COMMENT="Here are the results of testing the latest attachment JIRA_COMMENT="Here are the results of testing the latest attachment
$patchURL $patchURL
against master branch at commit ${GIT_COMMIT}. against ${BRANCH_NAME} branch at commit ${GIT_COMMIT}.
ATTACHMENT ID: ${ATTACHMENT_ID}" ATTACHMENT ID: ${ATTACHMENT_ID}"
### Copy the patch file to $PATCH_DIR ### Copy the patch file to $PATCH_DIR