What is GitLab?

GitLab is a DevOps software that helps developers work together on code at the same time, store and manage the code by developers and the whole team, help to keep track of the code changes, etc. Developers get many features for every stage of a development cycle.

How To Write CI/CD Pipeline Using GitLab?

In this article, we’ll learn how to create a CI/CD pipeline using Gitlab. We’ll use the Website version provided by Gitlab at Gitlab.com to avoid any problems with system requirements. We’ll create the CI/CD pipeline to automate the whole manual process of building, testing, and deploying an application every time there is a bug fix or a new feature is added to it After this tutorial you’ll be able to create your own CI/CD pipeline according to your own project need.

Similar Reads

What is GitLab?

GitLab is a DevOps software that helps developers work together on code at the same time, store and manage the code by developers and the whole team, help to keep track of the code changes, etc. Developers get many features for every stage of a development cycle....

What is the CI/CD Pipeline?

CI stands for Continues Integration and CD stands for Continuous delivery/Continues Deployment, it is a software development method that is continuous, which means continuously building, testing, deploying, and tracking changes in a code. And CI/CD pipeline refers to the steps or series of steps that help automate the whole CI/CD process to create software....

Prerequisites

Basic Knowledge of Git and Gitlab and an account on Gitlab or Gitlab installed on your local machine. A project to work on. Basic knowledge of Linux commands....

What we’ll do?

We’ll create a CI/CD pipeline for a website, which will execute automatically whenever changes are merged in the main branch, and then the website will go through 3 stages – build, test, and deploy and will go through the defined rules....

CI/CD Pipeline Using GitLab

Step 1: Create your Gitlab account from https://gitlab.com/. We’ll use the Website version, but you can also install Gitlab on your machine. Please refer the official guide to check the system requirements and installation methods as per your OS need....

Build Stage: To create build folder of the website

build-job: image: node stage: build script: - npm install - npm run build artifacts: paths: - "dist/"...

Test stage: To test the updated/created website

test-html: stage: test dependencies: [] script: - npm install --save-dev htmlhint - npx htmlhint "dist/**/*.html"...

Deploy stage: To deploy website

deploy: stage: deploy image: busybox dependencies: - build-job script: - mv dist/ public/ artifacts: paths: - "public/" rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH...

Conclusion

In this whole article we saw on how to create CI/CD pipeline in Gitlab to build, test and deploy a website. The automated process saves a lot of time when compared to manual process and reduces the chances of deploying a buggy application. Whenever there are committed and merged changes in the project/Software the pipeline runs. With this tutorial you got the basics with example on how this pipeline works and how to create that, now you just need to explore more in the Gitlab documentation to know more....

CI/CD Pipeline Using GitLab – FAQ’s

Can I apply CI/CD pipeline in any Software Project?...