This repository contains a set of scripts, configurations and templates for integrating Gerrit with GitLab CI.
Detailed tutorial here.
The gitlab-ci/build-templates
folder contains gitlab-ci files that can be used to build software developed with various technologies:
- android-gradle.yml: Android apps compiled with Gradle.
Pick the template you need, copy it to the root of the project and rename it to .gitlab-ci.yml
. Finally, customize it reading the instructions contained in the template itself (look for XXX
markers).
Gerrit hooks are used to react to Gerrit events and communicate with GitLab to achieve a full CI workflow:
- patchset-created: sends new patchsets to GitLab and waits for the "verified" response
- comment-added: typing "recheck" as comment will trigger a new build
First of all, copy the gitlab.config.example
to you Gerrit's "etc" directory, rename it to gitlab.config
and customize it. Then, copy all the files to the hooks
directory (create it if not already there) and restart your Gerrit installation.
System requirements:
- php-cli
- php-curl
Needed Gerrit plugins:
Additional Gerrit configuration (etc/replication.config
):
# GitLab cannot read refs/for/*, we must push patchsets as branches
[remote "gitlab"]
url = git@gitlab.example.com:groupname/${name}.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push = +refs/changes/*:refs/heads/review/*
replicationDelay = 0
createMissingRepositories = true
(customize gitlab.example.com
and groupname
with a group name your gerrit user has access to).