gitlab-webhook-xmpp is GitLab web hook handler for XMPP multi-user chat notifications about repository push events written in Python using Twisted framework.
gitlab-webhook-xmpp runs on Python 3.6 or later. Clone the repo in the directory of your choice using git:
git clone https://github.com/3cky/gitlab-webhook-xmpp
Next, install all needed Python requirements using pip package manager:
cd gitlab-webhook-xmpp
sudo pip install -r ./requirements.txt
Then install gitlab-webhook-xmpp itself:
sudo python setup.py install
Before run gitlab-webhook-xmpp, you will have to create a configuration file. You could use
provided doc/gitlab-webhook-xmpp.cfg.example
as example. Change HTTP port and XMPP
account JID/password according to your preferences. Push repository URLs are mapped to
multi-user chat JIDs in [notifications]
section using comma-delimited
Unix filename patterns.
Multiple matches are allowed.
Run gitlab-webhook-xmpp by command twistd -n gitlab-webhook-xmpp -c /path/to/config/file.cfg
Open GitLab project settings -> Web Hooks, add URL of server running gitlab-webhook-xmpp and check "Push events" as trigger. Press "Add Web Hook" button. You could test added web hook by "Test Hook" button.
gitlab-webhook-xmpp uses Jinja2 template engine to compose notifications.
You could override internal template by your own file using template
variable in [message]
section of configuration file. After restart all consequent changes in template file will be
reloaded automatically.
I got error ImportError: No module named pkg_resources
under CentOS 6 while trying to run gitlab-webhook-xmpp
- Upgrade
setuptools
usingcurl https://bootstrap.pypa.io/ez_setup.py | python
command (as root)