Skip to content

CI/CD

Continuous Integration and Continuous Delivery/Deployment is an important part of DevOps, where a standard mode of operations are automated in a pipeline frequently, and reliably.

Differences between CI-CD-CD. Source

This process is usually integrated with a version control platform like Github and Gitlab. Both popular platforms provide in-built CI/CD automation called Github Actions and Gitlab-CI. They are largely free, with some paid add-on tools. Other popular ones include CircleCI and TravisCI.

Gitlab-CI

Basics

Gitlab CI is run by "runners", which are essentially google servers spun up when a job is activated. A series of jobs make up a pipeline, while certain jobs of a specific attribute are assigned to a stage. By default, all jobs in a stage needs to finish before the next stage's jobs starts.

A typical pipeline workflow consists of the various stages.

  1. Test: security scans, unit-tests, integration tests
  2. Build: building a docker image
  3. Deploy: deployment of image to dev/staging/production
A pipeline with various stages, and individual jobs, shown in Gitlab's interface

Yaml File

Gitlab-CI will auto run if a file called .gitlab-ci.yml is stored in the root of the repository. Inside the ymal file, containing mostly shell commands that tells runner what to execute. It can also refer to scripts stored in the repo so as to keep the ymal file short and concise.

Github Actions

Yaml File

Github Actions will auto run if one or more ymal file is located in the folder .github/workflows/.