Github user nchammas commented on a diff in the pull request:
https://github.com/apache/spark/pull/1816#discussion_r15977737
--- Diff: dev/run-tests-jenkins ---
@@ -24,62 +24,110 @@
FWDIR="$(cd `dirname $0`/..; pwd)"
cd "$FWDIR"
+function get_jq () {
+ # Get jq so we can parse some JSON, man.
+ # Essential if we want to do anything with the GitHub API responses.
+ local
JQ_EXECUTABLE_URL="http://stedolan.github.io/jq/download/linux64/jq"
+
+ echo "Fetching jq from ${JQ_EXECUTABLE_URL}"
+ curl --silent --output "$FWDIR/dev/jq" "$JQ_EXECUTABLE_URL"
+ local curl_status=$?
+
+ if [ $curl_status -ne 0 ]; then
+ echo "Failed to get jq." >&2
+ return $curl_status
+ fi
+
+ chmod u+x "$FWDIR/dev/jq"
+}
+
COMMENTS_URL="https://api.github.com/repos/apache/spark/issues/$ghprbPullId/comments"
-function post_message {
- message=$1
- data="{\"body\": \"$message\"}"
+function post_message () {
+ local message=$1
+ local data="{\"body\": \"$message\"}"
echo "Attempting to post to Github:"
echo "$data"
-
- curl -D- -u x-oauth-basic:$GITHUB_OAUTH_KEY -X POST --data "$data" -H \
- "Content-Type: application/json" \
- $COMMENTS_URL | head -n 8
+
+ # comment_id=$(
+ curl `#--dump-header -` \
+ --silent \
+ --user x-oauth-basic:$GITHUB_OAUTH_KEY \
+ --request POST \
+ --data-urlencode ="$data" `# for make benefit @, &, and other
annoyances` \
+ --write-out "HTTP Response: %{http_code}" \
+ --header "Content-Type: application/json" \
+ "$COMMENTS_URL" #> /dev/null #| "$FWDIR/dev/jq" .id #| head -n 8
+ # )
+ local curl_status=${PIPESTATUS[0]}
--- End diff --
I'm still playing with this, but basically I'd like to catch the http
responses from curl in a clean way that also allows us to parse the JSON output
if desired. That way, we make it easier in the future to do fancier things.
> it might be better to have it show as green in jenkins if the tests pass,
even if the curl fails.
Ah, I see. Point taken. OK, so right now my intention is to just track
status cleanly as a future-proofing measure, but not fail the build on curl
failures.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]