Configuration

The majority of the Patchlab configuration is inside a Django settings file.

Django

Django settings specific to Patchlab.

Patchlab is intended to be run as an extension to Patchwork, so you should start with a valid patchwork configuration and include the settings documented here in that file.

Note

Don’t forget to add Patchlab to the INSTALLED_APPS list. If you’re using the production.example.py settings file provided by Patchwork as the starting point, adding INSTALLED_APPS.append("patchlab") to the end of the file is enough.

Patchlab uses Django’s builtin email framework so be sure include email related Django settings.

patchlab.settings.base.PATCHLAB_GITLAB_WEBHOOK_SECRET = 'change this'

The secret token GitLab is configured to send with the web hook. Patchlab uses this to validate the received payload. This should be a securely generated random string.

patchlab.settings.base.PATCHLAB_MAX_EMAILS = 25

The maximum number of emails to send out when bridging a merge request to the mailing list. This can be helpful to avoid sending patch series that are many thousands of commits accidentally. If the number of commits in a merge request exceed this number, an email with instructions on how to pull the git branch for local review is sent instead of the series.

patchlab.settings.base.PATCHLAB_REPO_DIR = '/var/lib/patchlab'

The directory to store Git trees in. The scheme inside this directory is <forge-host>-<forge-id>.

Git

Patchlab makes use of the git command line to apply patches and open merge requests on GitLab. As such, the user that runs the parsemail.sh or series2gitlab service needs a valid git configuration that contains at least a user and email:

[user]
email = you@example.com
name = Your Name

Git repositories should be stored in PATCHLAB_REPO_DIR/<git-forge-hostname>-<git-forge-id> and have write access to the “origin” remote where it pushes branches.

Gitlab

Patchlab uses python-gitlab when interacting with Gitlab. /etc/python-gitlab.cfg or ~/.python-gitlab.cfg should contain a configuration section for each Gitlab host being bridged:

[global]
ssl_verify = true
timeout = 30

[gitlab.example.com]
url = https://gitlab.example.com
private_token = abc123

[other-gitlab.example.com]
url = https://other-gitlab.example.com
private_token = 123abc

For details, see the python-gitlab documentation.