This is an easy to use nodeJS based web hook for GitLab.
This is an easy to use nodeJS based web hook for GitLab.
npm install gitlabhook
var gitlabhook = require'gitlabhook';var gitlab = gitlabhook/* options */ callback; gitlablisten;
Configure a WebHook URL to whereever the server is listening.
0.0.0.03240gitlabhook.conf['/etc/gitlabhook/', '/usr/local/etc/gitlabhook/', '.']false. Mostly only for debugging purposes.logger:{info:function(s){}, error:function(s){}}). Mostly only for debugging purposes.{repo1:'cmd1', repo2:['cmd2a','cmd2b','cmd2c']})/bin/shThe config file will be ignored if a callback function is declared.
Example config file with task definitions:
"tasks": "myRepo": "/usr/local/bin/myDeploy %g" "*": "echo 'GitLab Server %s'" "echo 'Repository: %r'" "echo 'User: %u'" "echo 'Branch: %b'" "echo 'Git Url: %g'" "echo 'Last Commit: %i'" "echo '\tMessage: %m'" "echo '\tTime: %t'"
The * matches any tasks.
The place holders are:
%s: GitLab server's IP address%r: name of the repository (e.g. myRepo)%u: owner of the repository (user name)%b: branch reference (e.g. refs/heads/master)%g: ssh-based cloning url on the GitLab server (e.g. git@gitlab.host:rolf.niepraschk/myRepo.git)%h: http-based cloning url on the GitLab server (e.g. http://gitlab.host/rolf.niepraschk/myRepo.git)%i: id of the last commit%t: timestamp of the last commit%m: message of the last commitMIT