GitLab's Inception: Tracing the Start of a Powerful Tool - part 1

Harshal ThoratHarshal Thorat
3 min read

GitLab is an all-in-one DevOps platform that lets you manage your repositories, CI/CD pipelines, secrets, runners, and deploymentsโ€”everything under one roof.

๐Ÿ“Œ What You'll Learn

  • What is GitLab?

  • How is GitLab different from GitHub/Bitbucket?

  • How to use GitLab?

  • Creating and managing projects & groups

  • Building pipelines with .gitlab-ci.yml

  • Secrets, Variables, and Artifacts

  • Self-hosted vs SaaS Runners

  • Deploying projects via GitLab CI/CD

๐Ÿ”ฐ What is GitLab?

GitLab is a web-based Git repository manager with features for issue tracking, CI/CD, and more. It allows you to plan, build, test, and deploy in one unified platformโ€”perfect for DevOps workflows.

๐Ÿ”„ GitLab vs GitHub vs Bitbucket

FeatureGitLabGitHubBitbucket
CI/CDBuilt-inThird-party (e.g., Actions)Integrated
Self-hostingYesLimited (via GitHub Enterprise)Yes
Free Private ReposYesYesYes
DevOps LifecycleComplete platformLimited to code & actionsPartial

๐Ÿ› ๏ธ Getting Started with GitLab

1. Create EC2 instance and set up your local machine.

2.Learn how Groups and Projects (Repos) are structured.

URL: gitlab.com/group_name/project_name

Example: gitlab.com/harsh/node-tod-cicd

3.Connect to EC2 using an SSH key.

4.Understand how to import GitHub repos into GitLab using the project URL.

๐Ÿ” GitLab CI/CD Basics

To set up CI/CD, create a file named .gitlab-ci.yml in the root of your repo.

This YAML file defines:

  • Pipeline โž List of stages

  • Stages โž Sequence of execution (e.g., build, test)

  • Jobs โž Tasks executed inside stages

Sample Pipeline Flow

stages:
  - build
  - test
  - push
  - deploy

build-job:
  stage: build
  script:
    - echo "Building..."

test-job:
  stage: test
  script:
    - echo "Running tests..."

push-job:
  stage: push
  script:
    - echo "Pushing code..."

deploy-job:
  stage: deploy
  script:
    - echo "Deploying..."

๐Ÿƒ Runners in GitLab

Runners are the agents that execute your CI/CD jobs.

  • GitLab provides shared runners by default.

  • You can also self-host your own runners.

you can copy and paste this script given at top right corner inside your server with after

sudo su 
// gives you super user access
//after this cmd copy that scrpit provided by how to install gitlab runners? inside Register runners

๐Ÿ” Variables & Secrets

  • GitLab supports both inbuilt and user-defined variables.

  • Secrets can be masked and encrypted for safe usage.

  • Use these variables in your .gitlab-ci.yml for dynamic configurations.

๐Ÿ“ฆ Artifacts

Artifacts are the outputs of your CI/CD jobs.

Examples:

  • Logs

  • Reports

  • Compiled binaries

They can be shared between jobs and stages for better traceability.

๐Ÿ”– Branching Strategy & Tagging

you can follow a simple branching model:

main โ†’ dev โ†’ prod โ†’ feature

You can also create tags during pipeline runs to mark versions based on releases or environments.

0
Subscribe to my newsletter

Read articles from Harshal Thorat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Harshal Thorat
Harshal Thorat

Software Developer successfully implemented DevOps principles