GitLab/Phabricator integration

From Wikitech
Jump to navigation Jump to search

Intro

gitlab-phabricator listens for GitLab project update events, looks for Phabricator bug ids in them, and posts comments to those tickets as appropriate.

How it works

At https://gitlab.wikimedia.org/admin/hooks we configured a system hook which sends all 4 types of events (repository update, push, tag, merge request) to https://gitlab-webhooks.toolforge.org/hooks. A secret token is included in the notifications. gitlab-phabricator examines the events looking for Phabricator bug ids. For each bug id found, a comment is added to the corresponding ticket describing the event (for certain event types).

Bug ids are accepted in the following formats:

Bug: T12345
Bug: #12345

There can be multiple Bug: entries per commit message, one per line.

The `Bug: T...` format is accepted as it's the legacy format used in Gerrit. `Bug: #...` is compatible with the (limited) custom issue tracker support in GitLab.

Administration

gitlab-webhooks.toolforge.org is hosted on Toolforge. To administer it you must be listed as a maintainer of the tool. Ask an existing administrator to give you access. When you have access you can do:

ssh login.toolforge.org
user@tools-sgebastion-10:~$ become gitlab-webhooks

The https://gitlab.wikimedia.org/repos/releng/gitlab-phabricator repo is cloned at www/python/src. The config.yaml file in this directory contains the runtime configuration (including the Phabricator URL, the Phab username and token to use when making comments). config.yaml contains secrets, so make sure it always has mode 0600.

If you make code or configuration changes (e.g., by pulling down new code by running git pull) you must restart the webservice for the changes to take effect. You can do this by running ~/restart.

Maintainer

gitlab-phabricator is maintained by the mw:Wikimedia Release Engineering Team.