|
@@ -30,15 +30,20 @@ for HEAD in $@; do
|
|
|
#BRANCH=${BRANCH[2]}
|
|
|
REST_OF_JSON=$(git --no-pager log -n 1 --format='{"hashes":{"commit":"%H", "tree":"%T", "parents":"%P" }, "author":{"date": "%ai", "name":"%an", "email":"%ae" }, "committer":{"date": "%ci", "name": "%cn", "email":"%ce" }')
|
|
|
REST_OF_JSON=$REST_OF_JSON,\"branch\":\""${BRANCH}"\"
|
|
|
- #REST_OF_JSON=$REST_OF_JSON,\"giturl\":\"$GITURL\""}"
|
|
|
+ #REST_OF_JSON=$REST_OF_JSON,\"giturl\":\"$GITURL\"
|
|
|
JSON_TO_SUBMIT=$JSON_TO_SUBMIT{\"$BRANCH\":$REST_OF_JSON\}
|
|
|
- JSON_TO_SUBMIT=$JSON_TO_SUBMIT,\\n
|
|
|
+ JSON_TO_SUBMIT=$JSON_TO_SUBMIT}
|
|
|
REST_OF_JSON=""
|
|
|
done
|
|
|
|
|
|
+t=`mktemp`
|
|
|
+echo $JSON_TO_SUBMIT > $t
|
|
|
# Calculate the digest of JSON
|
|
|
SECRET=$(echo -n $JSON_TO_SUBMIT | openssl dgst -sha1 -hmac $SECRET_KEY)
|
|
|
SECRET=`echo $SECRET | cut -d'=' -f2`
|
|
|
# TODO: Consider submiting to HTTPS!
|
|
|
# Github uses X-Hub-Signature, we use X-Secret
|
|
|
-curl -H "Content-Type: application/json" -H "X-Secret:${SECRET}" -X POST http://${SUBMIT_HOST}:${SUBMIT_PORT}/ -d ${JSON_TO_SUBMIT}
|
|
|
+curl -H "Content-Type: application/json" -H "X-Secret:${SECRET}" -X POST http://${SUBMIT_HOST}:${SUBMIT_PORT}/ --data @$t
|
|
|
+if [ $? -eq 0 ]; then
|
|
|
+ rm $t
|
|
|
+fi
|