Continuous Integration: FAQ

From Gcube Wiki
Revision as of 01:49, 28 June 2019 by Manuele.simi (Talk | contribs)

Jump to: navigation, search

Q: What do I keep in a Git Repository?

A: For a correct answer, we first need to point out a fundamental difference between SVN and Git:

  • In SVN, there is one single repository, whose structure is equivalent to a file system. You can check out and work at any level of the SVN tree.
  • In Git, there are several repositories, independent from each other. You need to clone an entire repository to work on its content.

Given that, a multi-module Git repository (i.e. a repositories with several modules not grouped in a reactor build of a parent pom) is strongly discouraged. Such repository would force a developer to clone the entire repo, regardless the module he/she would work on. Also Jenkins would be in the same situation: clone a full repo to then build just a small piece of it.

Therefore, there are two ways to structure the content of a Git repository:

  1. as single software component
  2. as Maven multi-module project

A good way to start with is to create a Git repo for each Eclipse project. So, if you have a multi-module project with Maven, a single Git repo will work fine. The same is for the single component. The basic idea is that the POM in the root folder of the Git repo should build and deploy all the artifacts held in the Git repository. Jenkins also benefits from this type of structure because it just needs to invoke the root POM.

Aggregating modules logically connected into a single Maven multi-module project is recommended, whenever possible. It helps reduce the number of Git repositories and Jenkins projects, towards a better sustainability of the integration and delivery procedures.