How GitLab CI/CD work
I am a newbie to the GitLab CI/CD pipeline, and this video helped a ton:
This article is about what I’ve learned in the video.
GitLab is not only a git repo platform. It is also a CI/CD pipeline platform.
We tell GitLab how to run the pipeline for a project by writing the .gitlab-ci.yml file. This file defines jobs and stages. Each job is run as a container with which you can specify a docker image. Each job can be assigned to a stage. Stages are run sequentially. Jobs in a stage run in parallel.
In the video, Nana had 3 stages: Test, Build, and Deploy stages.
In the test stage, she ran a job that run the tests in the project.
In the Build stage, she built docker image and pushed the docker image to a private docker repository. We can define the secrets such as docker username and password in the GitLab settings and they are made available in the runner’s container.
In the Deploy stage, she sshed into a digital ocean server, pulled down the image, ran it.