Pre-commit hook for Git when Hudson build has failed
-
02-10-2019 - |
Question
I'm trying to figure out how to write a pre-commit hook for Git
that checks the status of my Hudson
build. If the previous build failed, it should disallow anyone from committing without first writing a specific line, e.g. "fixed build."
EDIT:
The first answerer has provided one side of the coin: the Hudson API.
I now need the other side. How do I write the pre-commit hook in Git
?
Solution
As mentioned in this blog post, Hudson has a discoverable API, through its Remote Access API.
http://myhudson.example.com/job/MyJob/api
By using a combination of:
- wget (available on Unix or Windows)
- parsing
you can extract the status of the latest build.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow