Skip to content

Commit

Permalink
HIVE-8847 - Fix bugs in jenkins scripts (Brock reviewed by Szehon)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1639054 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Brock Noland committed Nov 12, 2014
1 parent 5dc2367 commit bce8c2b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
5 changes: 3 additions & 2 deletions dev-support/jenkins-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ fail() {
# Exports two variables of import:
# * BUILD_PROFILE - the profile which the ptest server understands
# * BUILD_OPTS - additional test options to be sent to ptest cli
# * PATCH_URL - the URL to the patch file
process_jira() {
test -n "$BRANCH" || fail "BRANCH must be specified"
test -n "$JIRA_ROOT_URL" || fail "JIRA_ROOT_URL must be specified"
test -n "$JIRA_NAME" || fail "API_PASSWORD must be specified"
test -n "$JIRA_NAME" || fail "JIRA_NAME must be specified"
JIRA_TEXT=$(mktemp)
trap "rm -f $JIRA_TEXT" EXIT
curl -s -S --location --retry 3 "${JIRA_ROOT_URL}/jira/browse/${JIRA_NAME}" > $JIRA_TEXT
Expand All @@ -39,7 +40,7 @@ process_jira() {
fail "$JIRA_NAME is not \"Patch Available\". Exiting."
fi
# pull attachments from JIRA (hack stolen from hadoop since rest api doesn't show attachments)
PATCH_URL=$(grep -o '"/jira/secure/attachment/[0-9]*/[^"]*' $JIRA_TEXT | \
export PATCH_URL=$(grep -o '"/jira/secure/attachment/[0-9]*/[^"]*' $JIRA_TEXT | \
grep -v -e 'htm[l]*$' | sort | tail -1 | \
grep -o '/jira/secure/attachment/[0-9]*/[^"]*')
if [[ -z "$PATCH_URL" ]]
Expand Down
42 changes: 28 additions & 14 deletions dev-support/jenkins-execute-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,56 @@ test -n "$BRANCH" || fail "BRANCH must be specified"
test -n "$API_ENDPOINT" || fail "API_ENDPOINT must be specified"
test -n "$LOG_ENDPOINT" || fail "LOG_ENDPOINT must be specified"
test -n "$API_PASSWORD" || fail "API_PASSWORD must be specified"
export JIRA_NAME="HIVE-${ISSUE_NUM}"
if [[ -n "$ISSUE_NUM" ]]
then
export JIRA_NAME="HIVE-${ISSUE_NUM}"
fi
export ROOT=$PWD
export JIRA_ROOT_URL="https://issues.apache.org"
export BUILD_TAG="${BUILD_TAG##jenkins-}"
echo $JIRA_NAME
if [[ -n "$JIRA_NAME" ]]
then
echo $JIRA_NAME
fi
set -x
env

process_jira
if [[ -n "$JIRA_NAME" ]]
then
process_jira
fi

profile=$BUILD_PROFILE
if [[ -z "$profile" ]]
then
profile=$DEFAULT_BUILD_PROFILE
fi
if [[ -z "$profile" ]]
then
fail "Could not find build profile"
fi

test -d hive/build/ || mkdir -p hive/build/
cd hive/build/
rm -rf ptest2
svn co http://svn.apache.org/repos/asf/hive/trunk/testutils/ptest2/ ptest2
cd ptest2

# sanity check the profile
case "$BUILD_PROFILE" in
trunk-mr1);;
trunk-mr2);;
*)
echo "Unknown profile '$BUILD_PROFILE'"
exit 1
;;
esac
mvn clean package -DskipTests -Drat.numUnapprovedLicenses=1000 -Dmaven.repo.local=$WORKSPACE/.m2
set +e
optionalArgs=()
if [[ -n "$JIRA_NAME" ]]
then
optionalArgs=(--patch "${JIRA_ROOT_URL}${PATCH_URL}" --jira "$JIRA_NAME")
fi
java -cp "target/hive-ptest-1.0-classes.jar:target/lib/*" org.apache.hive.ptest.api.client.PTestClient --endpoint "$API_ENDPOINT" \
--logsEndpoint "$LOG_ENDPOINT" \
--command testStart \
--profile $profile \
--password $API_PASSWORD \
--outputDir target/ \
--testHandle "$BUILD_TAG" \
--patch "${JIRA_ROOT_URL}${PATCH_URL}" \
--jira "$JIRA_NAME" ${BUILD_OPTS} "$@"
${optionalArgs[@]} ${BUILD_OPTS} "$@"
ret=$?
cd target/
if [[ -f test-results.tar.gz ]]
Expand Down

0 comments on commit bce8c2b

Please sign in to comment.