README.md 2.02 KB
Newer Older
Simon Latapie's avatar
Simon Latapie committed
1
2
# homer-bot

3
> D'oh!
Simon Latapie's avatar
Simon Latapie committed
4

5
6
7
8
A gitlab merge bot far more stupid than [marge-bot](https://github.com/smarkets/marge-bot).

It tries to get some information about a Gitlab project, and evaluate whether the MRs are ready to be merged **for real**.

9
10
It is a very dumb and conservative bot: stateless, oneshot (no daemon running).
It is mainly design to monitor merge requests, and not actually merge them.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

The only changes it is allowed to perform are:
- comment on a MR
- add/remove a label

## Build

```
go build
```

## Run

The following documentation is assuming you know your gitlab project identifier: just look at the Home page of your project, you should find a `Project ID: XXXXX` item.

Simon Latapie's avatar
Simon Latapie committed
26
27
28
29
30
31
32
33
Next, you need to generate a valid [Gitlab private token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html). The privileges related to the token need to be large enough to access the Gitlab API and be able to:
* get all members of the project (to check their role in the project)
* get Project's MRs information
* get Project's MRs pipelines information
* get Project's MRs award emojis (for the votes)
* get Project's MRs discussions
* add/remove a label on a Project's MR
* add a comment (`note` in gitlab) in a Project's MR 
34
35
36
37
38
39
40
41
42
43

Then, you need to provide this token through the `GITLAB_PRIVATE_TOKEN` environment variable.

You can also override the default gitlab API root URL with the `GITLAB_API_ROOT_URL` environment variable.

```shell
export GITLAB_PRIVATE_TOKEN=<your private token here>
export GITLAB_API_ROOT_URL=<your gitlab API root URL> # Default is https://code.videolan.org/api/v4
./homer-bot -project <projectId>
```
44

45
46
47
48
49
50
51
52
53
## Gitlab CI integration

You can use and manage Homer with the gitlab-ci schedules:
- create a schedule per project you want to monitor
- add the `GITLAB_PRIVATE_TOKEN`, `GITLAB_API_ROOT_URL` (if needed) and `PROJECTID` variables to the schedule environment
- run/cron the schedule!

This way Homer will be 100% managed (and monitored) by gitlab.

54
55
## Strategy

Simon Latapie's avatar
Simon Latapie committed
56
The current strategy is described in [this page](doc/acceptance.md).
57