A lightweight gitlab irc bot that announces gitlab project notifications via webhooks.
- Connecting to an IRC server over SSL
- Authing with Nickserv
- Support for announcing Commits, Merge Requests, Tags, and Issues.
- Tested on Ruby 2.2.3
- Tested with Gitlab CE 8.1.4
The following parameters can be set either in the config.yml file or via environment variables.
Option | Example Value | Description | Required? | Default |
---|---|---|---|---|
IRC_HOST | irc.freenode.com | IRC Server Hostname | Yes | |
IRC_PORT | 6667 | IRC Server Port | 6667 | |
IRC_PASSWORD | sample_password | Server Password | ||
SSL | true | if true, allows connection to irc server over ssl | false | |
IRC_CHANNELS | ['#dev','#all'] | Array of channels to join | Yes | ['#gitlab-irc'] |
IRC_NICK | GitLab | Bot Name | GitLab | |
IRC_REALNAME | GitLabBot | Real Name | GitLabBot | |
IRC_USER_NAME | gitlab-irc | Username for authing with nickserv | ||
IRC_USER_PASSWORD | user_password | Password for authing with nickserv | ||
DEBUG | true | false |
Start the gitlab-irc server with at least IRC_HOST and IRC_CHANNELS environment variables set:
docker run -e IRC_HOST=irc.freenode.com -e "IRC_CHANNELS=['#gitlab-irc']" -e IRC_NICK=gitlab-9875 -d -p 5000:5000 --restart=always --name gitlab-irc chkelly/gitlab-irc:v1.0.5
This assumes you have installed Ruby 2.2.3
git clone https://github.com/chkelly/gitlab-irc.git;
cd gitlab-irc;
mv config/config.yml.example config/config.yml;
vim config/config.yml
You can use the config.yml.example file that is provided to configure your connection.
Once completed, you can start the server using the following commands
cd gitlab-irc;
bundle exec unicorn -c config/unicorn.conf -D
Within Gitlab CE, select a project, then go to Settings -> Hooks, and enter in the below. Check all the boxes. Adjust the below host and port to point to the ip:port that the gitlab-irc service is running on.
http://localhost:5000
- If you encounter the following error and installed ruby with RVM:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/ckelly/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151116-6706-1j2d19j.rb extconf.rb
checking for CLOCK_MONOTONIC in time.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
reinstall your version of ruby with:
rvm reinstall ruby-2.2.3 --disable-binary