Marmot
Marmot is a bot who helps you with your merge
request in Gitlab. If you do not have specific reviewers but want different people
to acknowledge to a merge request marmot can help you. It will receive every change
in a merge request an will count the weight of all /lgtm commands. If they are more
than a given limit, marmot will try to merge the MR. If you do not want this,
marmot will create comments to signal, that the MR could be merged.
First of all, put a .marmot.yml file in your target branch; most of the time this is
the master branch of your repository:
merge_request:
author_can_vote: false
required_weight: 3
merge_on_agreement: false
remove_source_branch: false
when_pipeline_fails: false
weight:
owner: 2
master: 2
developer: 1
This file tells marmot what to do, when something changes in your merge requests. In this
example the settings are:
author_can_voteThis setting tellsmarmotif the author of the MR can also vote. Normally you set this tofalseotherwise someone can create a MR and put a/lgtmto upvote the code.required_weightTellsmarmotthe weight which must be gained so the MR can be accepted.merge_on_agreementShouldmarmotaccept the MR? If this is true,marmotwill try to merge. Please note thatmarmotneeds write access to your target branch! You should only do that if you are running a private instance ofmarmotin your environment.weightThe weights tellmarmotthe emphasis of a given/lgtm. In the upper example, when an OWNER or MASTER gives a/lgtmthis is counted as two whereas a/lgtmof a DEVELOPER will only weight 1.remove_source_branchDo not remove the source branch when merging.when_pipeline_failsOnly merge when the pipeline does not fail.
Note: You do not have to create this file, because
marmothas a default configuration. But it is recommended to have one, so you will always know howmarmotworks.
Now you can use marmot to receive update hooks. Go to your Gitlab project and open the
Integration Settings (https://.../settings/integrations). Here you can add a new Webhook
with the URL of marmot. You can take our webhosted version at https://marmot.watzmann.io.
Do not forget to activate the checkboxes for Comments and Merge Request events.
marmot will now jabber in your MR’s. Everytime someone gives a /lgtm you will
receive a note by marmot about the current emphasis. You can also give a /rating command
and will get a note about the current rating. In the upper example at least three developers or
a developer and a master or owner must give a /lgtm so the MR can be merged.
As long as you do not set merge_on_aggreement to true, marmot will not try to merge, but
will always give you a status.
How about new commits?
Marmot only counts /lgtm’s after the latest commit timestamp. So if your MR has enough
/lgtm ratings and there is a new commit in the source branch, the whole state will be
reset and the counting starts again.
What about issues?
Yes, it would be great to also check new issues, label them, etcpp. Not now, but perhaps in the future?