Skip to content

Simple Gitlab webook receive job events (status success or failed) and notify to Telegram

License

Notifications You must be signed in to change notification settings

vietdien2005/gitlab-webhook

Repository files navigation

Gitlab Webhook

Simple Gitlab webook receive job events (status success or failed) and notify to Telegram

Configuration

Command

  • Command: python3 webhook.py --port 8989 --config ./config.yaml

Example config

# file: config.yaml
---
project/gitlab-repo:
  gitlab_token: your-token
  telegram_bot: your-telegram-bot-token
  telegram_group: your-telegram-group-id
  telegram_template: ./templates/your-template.jinja

Command Arguments

  • Port: Define the listen port for the webserver. Default: 8666
  • Address: Define the listen address for the webserver. Default: 0.0.0.0
  • Config: Define the path to your configuration file. Default: config.yaml

Help

usage: webhook.py [-h] [--address ADDRESS] [--port PORT] --config CONFIG

Gitlab Webhook

optional arguments:
  -h, --help         show this help message and exit
  --address ADDRESS  address where it listens (default: 0.0.0.0)
  --port PORT        port where it listens (default: 8989)
  --config CONFIG    path to the config file (default: None)

Systemd

[Unit]
Description=Gitlab Webhook
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/opt/gitlab_webhook/
ExecStart=webhook.py --port 8989 --config /opt/gitlab_webhook/config.yaml

[Install]
WantedBy=multi-user.target

Docker

  • Build image: docker-compose build or Pull Image: docker-compose pull

  • Run: docker-compose up or docker-compose up -d

  • Run without docker-compose:

docker run -d \
  -p 8989 \
  -v ${PWD}/config.yaml:/workspace/config.yaml \
  --name gitlab_webhook \
  vietdien2005/gitlab_webhook:latest

About

Simple Gitlab webook receive job events (status success or failed) and notify to Telegram

Topics

Resources

License

Stars

Watchers

Forks