Introduction to GitLab & CI/CD Concepts

25 minLesson 1 of 4

Learning Objectives

  • Understand the DevOps lifecycle and CI/CD concepts
  • Differentiate between Continuous Integration, Delivery, and Deployment
  • Navigate GitLab's interface and create projects
  • Understand GitLab Runners and their role

The DevOps Approach

DevOps combines development and operations to deliver software faster and more reliably. It breaks down silos between teams and emphasizes automation.

The DevOps Lifecycle

Plan → Create → Verify → Package → Release → Configure → Monitor
  ↑                                                          |
  └──────────────────────────────────────────────────────────┘

CI/CD Explained

TermMeaningAutomation Level
CI (Continuous Integration)Build and test on every commitAutomated testing
CD (Continuous Delivery)Ready to deploy at any timeManual deploy trigger
CD (Continuous Deployment)Auto-deploy to productionFully automated

CI Pipeline Example

Push Code → Build → Unit Tests → Integration Tests → Package

CD Pipeline Example

Package → Deploy to Staging → Acceptance Tests → Deploy to Production

What is GitLab?

GitLab is an integrated DevOps platform that provides:

  • Source code management (like GitHub)
  • CI/CD pipelines (built-in)
  • Container registry
  • Issue tracking
  • Security scanning
  • Deployment environments

GitLab vs GitHub

FeatureGitLabGitHub
CI/CDBuilt-in (GitLab CI)GitHub Actions
RegistryIntegrated container registryGitHub Packages
Self-hostedFree (Community Edition)Enterprise only
DevOps focusFull lifecycleCode-centric

GitLab CI Components

ComponentRole
.gitlab-ci.ymlPipeline configuration file
RunnerMachine that executes jobs
PipelineCollection of jobs organized in stages
StageGroup of jobs that run in parallel
JobIndividual task (build, test, deploy)
ArtifactFiles produced by jobs

How It Works

Developer pushes code
    → GitLab detects .gitlab-ci.yml
    → Pipeline is created
    → Runner picks up jobs
    → Jobs execute in stages
    → Results reported back

GitLab Runners

Runners are agents that execute CI/CD jobs. Types:

TypeScopeUse Case
SharedAll projectsGitLab.com default
GroupAll projects in a groupTeam-wide
SpecificSingle projectCustom environments

Executor Types

ExecutorDescription
ShellRuns commands directly on the runner machine
DockerRuns jobs inside Docker containers
KubernetesRuns jobs as Kubernetes pods

Creating a GitLab Project

  1. Sign up at gitlab.com
  2. Click New ProjectCreate blank project
  3. Name it, set visibility, check "Initialize with README"
  4. Click Create project

Summary

  • DevOps combines development and operations for faster delivery
  • CI automates building/testing; CD automates deployment
  • GitLab provides an integrated platform for the entire lifecycle
  • .gitlab-ci.yml defines your pipeline configuration
  • Runners execute the jobs defined in your pipeline
  • Stages organize jobs; jobs within a stage run in parallel

Next Steps

Next, we'll write .gitlab-ci.yml files and configure complete CI/CD pipelines.