Tools 🛠
- Gitlab Integration Webhook
- node-gitlab-webhook — Gitlab Webhooks handler based on Node.js. Support multiple handlers.
- pm2 — Advanced, production process manager for Node.js
- shelljs — Unix shell commands for Node.js
Get Started — The Quite Hard Part
Create Bash Script for pulling and building our script
Create Node.js Application for Listening for Webhook
You need to have Node.js and npm installed on your server.
Create project directory
mkdir node-hook
Change Directory to the project
cd node-hook
Initialize NPM
npm init -y
Install Needed Packages
npm install shelljs node-gitlab-webhook — save
Create Entry Point
touch index.js
index.js
Installing PM2
sudo npm i -g pm2
Run the Application
pm2 start index.js
Automated Startup (Optional)
sudo pm2 startup ubuntu
Configuration Gitlab Project — The Simple Part
Go to YourProject > Setting > Integrations
There are two input fields, URL and Secret Token
URL : http://YOUR_PUBLIC_IP:7777/webhook
Secret Token : superS3cret
You can also Trigger other events like Tag, Comments, Issues and more.
Make sure the check box Enable SSL verification is unchecked if your IP is not HTTPS.
This is not perfect enough but it works