Kind Sir is a Gitlab satellite project. It allows to automatically accept merge requests which got specific number of upvotes during the code review with respect to build status.
Application reads config file and grabs a list of groups from Gitlab API to monitor. The separate supervisor actor will be spawned for each group. Once per minute groups' supervisor spawns Repo Worker actor for each repository in this group.
Repo worker tries to find .kind_sir.conf
file in the root of repository.
If there is no such file, worker will stop and repository will not
be processed. Otherwise Repo Worker will read this file and grab a list of
opened Merge Requests from the repository. After that it will check the number of
upvotes and downvotes for every merge request. And if request has
enought upvotes and meets the requirements of Veto settings and build status,
Repo Worker will try to merge it.
- Git clone this repository
- Run
activator assembly
inside the repository directory - Grab
kind_sir.jar
file produced by theassembly
from the root of project directory. - Deploy this file to the target system
- Create Gitlab user on behalf of whom Kind Sir will be acting
- Add this user to any number of groups, which you want to be monitored by Kind Sir
- Find
private_token
of this user in Gitlab's profile section - Create configuration file described below
- Run
java -Dconfig.file=<your-config.conf> <kind-sir-assembly.jar>
git clone https://github.com/answr42/kind-sir.git
cd kind-sir
touch config.conf
and fill itdocker build -t kind-sir .
docker run --name kind-sir -d kind-sir
Kind Sir uses two kinds of configuration files:
- Application configuration file, deployed with Kind Sir itself
kind_sir.conf
. Acceptance policy configuration placed in the root of monitored repository
App configuration file is just a normal Lightbend Config file. There are only two fields you can specify here:
- Gitlab URL
- Private Token for a user on whose behalf Kind Sir will be acting.
- Gitlab API version. If you don't know your GitLab API version, you can check GitLab version at
https://your.gitlab.domain.name/help
and than choose:
- If GitLab < 9.0, you probably need to choose 3.
- If GitLab >= 9.0, you still can use 3, but 4 is the preferred version to be used.
- If GitLab >= 9.5, 4 is only available version at that moment.
For example, let's imagine you created config.conf
:
kindSir {
gitlab-url = "https://gitlab.acme.com"
gitlab-token = "ex_MT1jP5t1DeSnN4ka9"
gitlab-api-version = 4
}
After that you can run Kind Sir with command:
java -Dconfig.file=config.conf -jar kind-sir-assembly-0.1.jar
You should place config file named .kind_sir.conf
in the root of
every repository you want to be monitored by Kind Sir.
This is a regular JSON file.
You can find an example right in this repository.
There are also only three things to specify:
upvotes_threshold
: if the number of upvotes minus number of downvotes exceed specified number, request will be mergedveto_enabled
: true value means request will never be accepted if there is at least one downvote.- Optional
ignore_build_status
: if true, Kind Sir will merge request even if build failed or there were no build at all.
Example:
{
"upvotes_threshold": 2,
"veto_enabled": false,
"ignore_build_status": false
}