The goal is to have green master after every merge. To achieve this you have to rebase every single merge request just before the merge and wait for the pipeline status. It takes a lot of time of manual maintenance, especially when you have to process a big chunk of merge requests (common situation for large projects, monorepos etc.). So let's automate it with GitLab MergerBot.

bot:skip-squash label is present on the MR.bot:high-priority is present. Useful for hotfixes etc.api scopeWe strongly recommend using a separate account for bot-user. Don't reuse existing account which can leave the project in the future.
General Settings - Merge Request section:
Merge method to Fast-forward mergeOnly allow merge requests to be merged if the pipeline succeedsAll discussions must be resolvedTo add the Helm Chart for your local client, run helm repo add:
helm repo add gitlab-merger-bot https://pepakriz.github.io/gitlab-merger-bot
And install it:
helm install --name gitlab-merger-bot gitlab-merger-bot \
# --set settings.gitlabUrl="https://gitlab.mycompany.com" \
--set settings.authToken="<token>"
docker run -d --name gitlab-merger-bot --restart on-failure \
# -e GITLAB_URL="https://gitlab.mycompany.com" \
-e GITLAB_AUTH_TOKEN="<token>" \
-v "$(pwd)/data":/data \
pepakriz/gitlab-merger-bot:latest
yarn install
yarn run build
GITLAB_AUTH_TOKEN="<token>" yarn run start
| Env variable | Default value | |
|---|---|---|
GITLAB_URL | https://gitlab.com | GitLab instance URL |
GITLAB_AUTH_TOKEN | required Your GitLab token | |
CI_CHECK_INTERVAL | 10 | Time between CI checks (in seconds) |
MR_CHECK_INTERVAL | 20 | Time between merge-requests checks (in seconds) |
REMOVE_BRANCH_AFTER_MERGE | true | It'll remove branch after merge |
SQUASH_MERGE_REQUEST | true | It'll squash commits on merge |
AUTORUN_MANUAL_BLOCKING_JOBS | true | It'll autorun manual blocking jobs before merge |
SKIP_SQUASHING_LABEL | bot:skip-squash | It'll skip squash when MR contains this label |
HI_PRIORITY_LABEL | bot:high-priority | It'll put MR with this label to the beginning of the queue |
SENTRY_DSN | `` | It'll enable Sentry monitoring |
HTTP_SERVER_ENABLE | false | It'll enable experimental API and dashboard support |
HTTP_SERVER_PORT | 4000 | It'll use different http server port |
WEB_HOOK_TOKEN | `` | It'll enable experimental web hook support |
For web hook development use this:
NGROK_AUTH=<authCode>
docker run -it --rm --net=host -p 4040:4040 -e NGROK_AUTH="$NGROK_AUTH" wernight/ngrok ngrok http 4000
Content type
Image
Digest
sha256:e211c5acc…
Size
28.4 MB
Last updated
almost 2 years ago
docker pull pepakriz/gitlab-merger-bot