Gerrit - Gitlab Integration

dasrohith picture dasrohith · Apr 22, 2014 · Viewed 17.6k times · Source

In order to improve the development process, our organization have decided to introduce Gerrit in the development workflow. I am the person responsible for implementing Gerrit server. The user guides available in internet were very helpful in implementing Gerrit to our existing workflow. We are using Jenkins and Sonar as Non-interactive users for verifying the builds. But while dealing with repositories one question rises. Most of the open sources are using gerrit-replication plugin to replicate the latest code to their public code repository. These public repositories are exposed using GitLab so that the users can clone the code. Here we doesn't need a public repository as the code is maintained in house.

Is it a good choice to point both GitLab and Gerrit to a common git repository location?

Any help appreciated.

Answer

volker picture volker · Nov 4, 2014

You can use gerrit in front of gitlab via the replication feature. The replication feature does not do a git clone/fetch, it only pushs (approved) changes to a remote repository.

  • you have to import repositories via e.g. 'git push origin master' which requires extra permissions (or you need to be the admin). That is not a big deal unless you forget to remove these permissions. If you forget to remove these permissions or are administrator (who has these permissions): a default "git push" will make it through without being reviewed.
  • you have to make sure that no one can commit to the gitlab instance. Else you have a high chance to run into merge conflicts (gerrit is not aware of these new commits). You can protect the branches in gitlab -- but the admins (and if I remember correct also the repository creator/owner) will always have this right, too.
  • You have to grant a gerrit user master permissions to allow it push to the gitlab repository.
  • All projects have to be first created in gitlab, else they will not be synchronized (unless you find a way that the repo will be automatically created in gitlab on the first git push)