December 4, 2020
Continuous Integration (CI) is a development practise in which developers push code into to a shared repository such as git more frequently. Each time code is checked into the repository, it is automatically built and tested to ensure new changes have not broken the application. This gives the development team the opportunity to validate new code in smaller chunks and leads to better software quality.
After the build, testing and validation of the CI stage, Continuous Delivery (CD) automates the release of the software to selected environments. This can be production or testing/staging environments. It allows the development team to check the behaviour of the software in different conditions. In the CI/CD process, the goal is to have software in a state where it is always ready for deployment to production.
Gitlab is a popular git repository manager which also includes many DevOps and lifecycle tools. One such feature they provide is their CI/CD pipeline features.To get started with Gitlab CI/CD firstly we need to make a .gitlab-ci.yml file in our project. This file is how we describe to gitlab how to build, test and deploy our project. Below is an example of how a gitlab CI/CD config file might look.
Which results in a CI/CD pipeline automatically being ran at gitlab on each commit. The pipeline above will install any dependencies, test the code and on a tag, deploy a new version of this node library. We can then look at the result of each pipeline and check for errors before deploying to production.
CI/CD pipelines are a powerful tool for any development team. Frequent, small changes with automatic validation makes working collaboratively on a single project less prone to the error of large merges which can potentially result in many conflicts.
I am a Software Engineer working as part of the nerd.vision team, mainly working on the backend systems and agents. When I'm not squashing bugs, I enjoy travelling, gaming and experiencing new foods and cultures.