A GitLab webhook bot for Matrix
Go to file
Brian J. Tarricone 2e05969295
Some checks failed
CI / CI (push) Failing after 2m18s
Release / Publish to crates.io (push) Successful in 4m0s
Release / Publish to Docker Hub (push) Failing after 13s
Updates for release
2023-09-20 18:18:46 -07:00
.gitea/workflows Downgrade docker/metadata action to v4 2023-09-20 00:08:40 -07:00
scripts Add support for issue events 2023-09-16 20:29:47 -07:00
src Use iid field (and not id) field for the correct issue ID 2023-09-20 18:17:54 -07:00
test-data Add support for issue events 2023-09-16 20:29:47 -07:00
.dockerignore Add docker files 2023-09-15 22:18:37 -07:00
.gitignore Initial import 2023-09-15 11:53:14 -07:00
Cargo.lock Updates for release 2023-09-20 18:18:46 -07:00
Cargo.toml Updates for release 2023-09-20 18:18:46 -07:00
Dockerfile Speed up docker rebuilds 2023-09-16 00:06:13 -07:00
LICENSE Add licensing info 2023-09-16 21:09:17 -07:00
README.md Add docker release info to readme 2023-09-19 23:40:29 -07:00
rustfmt.toml Initial import 2023-09-15 11:53:14 -07:00
sample-config.yaml Add configurable event publishing 2023-09-19 20:46:37 -07:00

bebot

Bebot is a Gitlab webhook handler that publishes messages to Matrix when interesting things happen in your configured repos.

Currently-supported Gitlab event types:

  • Push events
  • Tag push events
  • Issue events
  • Merge request events
  • Pipeline events (only publishes on failure for now)

Building

Bebot is written in Rust, and requires a Rust toolchain in order to build. The usual cargo build or cargo build --release will do the trick.

You can also build and install the latest released version of Bebot by running cargo install bebot.

Setup

Bebot requires a configuration file in YAML format. See sample-config.yaml for all existing configuration options, as well as documentation on what each option does.

When setting up the webhook in Gitlab, use the same token from the configuration file in the webhook's "Secret token" field. You should only select "Push events", "Tag push events", "Issues events", "Merge request events", and "Pipeline events". You can leave some of these out if you don't want Bebot to publish messages for everything.

Bebot does not support serving the webhook over TLS, so you will probably want to put it behind a reverse-proxy such as nginx.

In the scripts directory is a set-webhook.py script that can set up (or update) webhooks for your repository, automatically generating a token for you. If setting up the webhook for the first time, it will output to stdout a YAML snippet that goes under the repo_configs section of the configuration file. If you run the script with no arguments, it will print out usage details.

Running

After you've done all that, simply run Bebot:

bebot /path/to/config-file.yaml

You can set the BEBOT_LOG environment variable to increase or decrease logging verbosity. (Try debug, info, warn error, or off.)

Docker

A Dockerfile is also provided. When running the container it builds, mount the configuration file so it appears inside the container as /bebot/config/bebot.yaml.

Release images are published to Docker Hub.