Repository: tez
Updated Branches:
  refs/heads/master 9431ce6c3 -> 871ea80c0


TEZ-3913. Precommit build fails to post to JIRA (Jason Lowe via jeagles)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/871ea80c
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/871ea80c
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/871ea80c

Branch: refs/heads/master
Commit: 871ea80c04eccd6eb985fc2dd5cf46e0ecfc59cf
Parents: 9431ce6
Author: Jonathan Eagles <jeag...@yahoo-inc.com>
Authored: Mon Apr 9 16:42:29 2018 -0500
Committer: Jonathan Eagles <jeag...@yahoo-inc.com>
Committed: Mon Apr 9 16:42:29 2018 -0500

----------------------------------------------------------------------
 build-tools/test-patch.sh | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/871ea80c/build-tools/test-patch.sh
----------------------------------------------------------------------
diff --git a/build-tools/test-patch.sh b/build-tools/test-patch.sh
index e1fa0fb..9b457af 100755
--- a/build-tools/test-patch.sh
+++ b/build-tools/test-patch.sh
@@ -38,6 +38,8 @@ GREP=${GREP:-grep}
 PATCH=${PATCH:-patch}
 DIFF=${DIFF:-diff}
 JIRACLI=${JIRA:-jira}
+SED=${SED:-sed}
+CURL=${CURL:-curl}
 FINDBUGS_HOME=${FINDBUGS_HOME}
 
 ###############################################################################
@@ -702,10 +704,24 @@ $comment"
     echo 
"======================================================================"
     echo ""
     echo ""
+
+    # RESTify the comment
+    jsoncomment=$(echo "$comment" \
+      | ${SED} -e 's,\\,\\\\,g' \
+        -e 's,\",\\\",g' \
+        -e 's,$,\\r\\n,g' \
+      | tr -d '\n')
+    jsoncomment='{"body":"'"$jsoncomment"'"}'
+
     ### Update Jira with a comment
-    export USER=hudson
-    $JIRACLI -s https://issues.apache.org/jira -a addcomment -u tezqa -p 
$JIRA_PASSWD --comment "$comment" --issue $defect
-    $JIRACLI -s https://issues.apache.org/jira -a logout -u tezqa -p 
$JIRA_PASSWD
+    ${CURL} -X POST \
+      -H "Accept: application/json" \
+      -H "Content-Type: application/json" \
+      -u "tezqa:${JIRA_PASSWD}" \
+      -d "$jsoncomment" \
+      --silent --location \
+      "https://issues.apache.org/jira/rest/api/2/issue/${defect}/comment"; \
+      >/dev/null
   fi
 }
 

Reply via email to