In this page

Overview

This page is about implementing the Commit Policy Plugin with the Git version control system and GitLab.com. If you use Git alone (i.e. without GitLab.com), please see the Git page instead.

GitLab.com is the cloud version of the GitLab product. It should not be mixed with GitLab Community Edition and with GitLab Enterprise Edition, which are self-hosted solutions for Git management, and which are also supported by the Commit Policy Plugin.

Working with GitLab.com commit policies

The primary problem with GitLab.com is, that it does not allow users to customize the server-side hooks in their repositories. This is a deliberate design decision by GitLab.com, because freely modifying hooks could easily lead to bugs and security issues.

As the Commit Policy Plugin integrates with Git using hooks, this is not possible to implement the Commit Policy Plugin directly in the GitLab.com managed server-side repositories. Wait, just read on, because there is a viable solution though!

What you can absolutely do is executing the verification in the developers' own clone repositories! When all your developers install the hooks to their local clone repositories, then this scenario is essentially equivalent with installing the hooks to the blessed repository itself. This way you get the best of both worlds: hosting your repositories in the cloud, and verifying the commits pushed into that at commit time (in local clones).

Installing GitLab.com commit policies

The process looks like this:

  1. Create the commit policy.
  2. Send an email to all your developers and ask them to install the hook script for this policy to their local repositories.

Please note that a "share policy" feature that eases distributing and monitoring the hook script installation will be implemented soon. If this is valuable to you, please vote to the public feature request.

Has every team member installed the hook script?

First the bad news: this is not possible to strictly enforce the installation of the hook scripts. Why? If the hook script is not installed, then your Git is basically not talking to Jira, so the Commit Policy Plugin cannot know about your repository at all.

Nevertheless, administrators still have the possibility to keep their eyes on the commits, to spot the ones that are eventually violating the policy. For example, if you know that the policy requires mentioning a Jira issue, and a committer is sending commits without that, then clearly: he forgot to install the hook script! Contact him and ask him to do so.

We have an idea for a creative solution for this problem, using a post-mortem mechanism to automagically detect these missing installations. If this is valuable to you, please vote to the public feature request.

No other limitations

Other than the inability to install directly to the blessed repository, all features of the Commit Policy Plugin for Jira work without limitations, also for GitLab.com managed repositories.

Questions?

Ask us any time.