Using GitLab’s web hooks with Crucible
We have made available a new tool, Crucible Hook, to allow GitLab to notify Crucible about new commits.
Rather than having external services (Crucible, Jenkins, etc.) constantly poll your Git server checking for updates, it can often be advantageous to use commit hooks instead. Using commit hooks removes often unnecessary Git operations (polling when there are no changes). Further, using commit hooks actually allows your dependent services to respond immediately (rather than waiting for the next polling interval to hit).
Unfortunately, if you are using GitLab there is not an out of the box way to support notifying Crucible about commits. The web hooks made available by GitLab only allow specifying a URL for HTTP operations.
Crucible’s support for commit hooks requires a specifically formatted POST operations (with custom headers).
That gap is what Crucible Hook can close. It exposes a REST API that can be used in GitLab as the target of web hook requests. The URL for the REST request includes the name of the repository in Crucible. Upon receiving each request, that Crucible repository is notified about the new commit(s).
Setting up the tool is as easy as:
- Deploying it to a web server
- Setting the URL and REST API token of your Crucible server
- Adding a web hook to the repositories in GitLab