[SPARK-2912] include commit hash in messages

This commit makes 2 major changes to the Jenkins GitHub hook:
1. Include commit hashes in all messages posted to GitHub. This makes
it clear what set of code changes a given test cycle is for.
2. Reorganize the code so it’s easier to maintain.

Changes made as part of the code reorg include:
* Cleanly capture and report on errors when calling the GitHub API.
* Divide the code into clear blocks: pre-test; test; and post-test