Skip to content

Continuous Integration

Continuous integration is the process of frequently merging your development changes into the main branch. This is especially useful when there is more than one developer. Using continuous integration comes with several benefits, such as:

  • Incompatibilities are detected earlier
  • Bugs are detected earlier
  • Merge hell is avoided or at least mitigated

When continous integration is used in combinated with continous deployment, it is known as CI/CD. In traditional software development, you might work on a feature in a feature branch for a long time. Only when your feature is complete do you merge it to the main branch and release it.

With CI/CD, you don't do this. Instead you split your feature into smaller pieces and frequently merge smaller pieces to the main branch. You may also release smaller pieces even though the feature is not yet complete. To avoid an incomplete feature being used by users, feature flags can be used to conditionally enable/disable features.

CI/CD Pipeline

A CI/CD pipeline is a process that automates your integration and deployments. It is split into several steps. The steps may include:

  • Lint
  • Build
  • Test
  • Provision
  • Deploy
  • Release

Currently we don't yet have any software to build, this will come in a later section of the guide. However we already have a CI/CD pipeline. In the GitLab Pages section of this guide we created the CI/CD pipeline to automatically build and deploy our documentation. Then later in the CI section on the Infrastructure as Code page we added another pipeline stage to automatically provision our infrastructure.

To view runs of your CI/CD pipelines in GitLab, open the "Build" accordion on the left sidebar and select "Pipelines":

Pipeline

Your pipeline runs should be displayed. Note that in our case three pipeline stages are displayed even though we explicitly only added two earlier. This is because when we added the "documentation" stage to automatically build and deploy our documentation to GitLab pages, GitLab implicitly added a "deploy" stage for the deployment.