GitLab CI/CD Pipeline

GitLab is a great tool for software engineers who want to write software, collaborate with other engineers, execute automated tests and deliver it.

It is similar to GitHub but I personally like GitLab more because of its built-in CI/CD tooling. It embraces the concept of infrastructure as code and it allows any project to add its own CI/CD pipeline configuration in a script called .gitlab-ci.yml that integrates perfectly with container images (docker).

GitLab executes this pipeline whenever code is pushed to its git repository and it is capable of referencing a docker image where all the commands to compile, run tests or publish packages, are available. That allows you to embrace containers and not to worry about having to install one by one all the tooling needed, so you can simply create your own docker image, have it available on some repository and reference this image from your gitlab continuous integration script.

As a basic example, let's imagine we have a dotnet core application and we want to compile this application and run all its unit/integration tests every time we push any change to the master branch. We would simply need to create a .gitlab-ci.yml file at the repository root level and GitLab will do its magic. It will download the dotnetcore2.2 image from a repository and use its dotnet commands to restore, compile and execute all the unit tests (xUnit) projects that have the Tests suffix.