项目作者: skiptirengu

项目描述 :
Webhook integration Gitlab -> Mantisbt
高级语言: Go
项目地址: git://github.com/skiptirengu/go-mantis-webhook.git
创建时间: 2018-05-08T05:04:59Z
项目社区:https://github.com/skiptirengu/go-mantis-webhook

开源协议:BSD 2-Clause "Simplified" License

下载


Mantis webhook

Webhook integration Gitlab -> Mantisbt

This webhook aims to integrate Gitlab with Mantisbt by closing issues listed on a commit message.
It also provides some nice features like email aliasing and project mapping.

Getting started

All you need to run this webhook is Go (any version, but the newer the better) and a Postgresql database. You can download the prebuilt package with a docker configuration to quickly get it running.

This webhook use both soap and REST mantis apis, so make sure both of them are enabled before you continue.

Configuration

This is an example of config.json you need to create on the root directory on the webhook.

  1. {
  2. "port": 8090,
  3. "secret": "secret_token",
  4. "database": {
  5. "host": "localhost",
  6. "database_name": "go-mantis",
  7. "user": "postgres",
  8. "password": "postgres"
  9. },
  10. "gitlab": {
  11. "token": "my_gitlab_token"
  12. },
  13. "mantis": {
  14. "host": "http://localhost:8989",
  15. "user": "administrator",
  16. "password": "root",
  17. "token": "QAei2Pozy2FHd_5fFx2Bw3SH8obe4e49"
  18. }
  19. }

Endpoints

Webhook

All requests under /webhook are authorized by the token you set on your Gitlab repository. The webhook will check for it under the request’s X-Gitlab-Token header and compare it with the token you set on the config.json under gitlab.token.

POST /webhook/push

The endpoint you need to register on your Gitlab repository.

Application

All requests under /app are authorized by the token you set on you config.json under secret. The app will check for the token under the request’s Authorization header.

POST /app/projects

Associates a new Gitlab project with a Mantis one.

Params:

  1. {
  2. "gitlab_project": "test/test",
  3. "mantis_project": "Test project"
  4. }

POST /app/aliases

Registers an email alias for a Mantis user.

Params:

  1. {
  2. "email": "my.mantis.email@example.com",
  3. "alias": "my.other.email@example.com"
  4. }