Tutorial

GitLab CI/CD Tutorial

Master GitLab CI/CD from scratch: pipelines, stages, jobs, runners, variables, Docker builds, testing, security scanning, AWS deployments, and multi-project pipelines.

16 lessons in this tutorial

1

Introduction to CI/CD

Learn what CI/CD means: how continuous integration, delivery and deployment differ, why teams need automation and what a modern pipeline looks like.

2

Getting Started with GitLab CI/CD

Create your first GitLab CI/CD pipeline: write a minimal three-stage .gitlab-ci.yml, understand GitLab Runners, trigger a pipeline and read the job output.

3

GitLab CI/CD Pipeline Structure: How Pipelines, Stages, Jobs, Artifacts and Cache Fit Together

See how a GitLab pipeline is built: how pipelines, stages and jobs relate, what runners do, how needs breaks stage lockstep and where artifacts fit.

4

GitLab CI Stages and Jobs

Define GitLab CI stages and jobs: the stages keyword and ordering, job scripts, core job keywords, rules and only/except conditions, and parallel jobs.

5

GitLab CI Artifacts

Use GitLab CI artifacts to pass files between jobs and keep build output: set paths and expire_in, download from the UI, and compare dependencies with needs.

6

GitLab CI Cache

Speed up GitLab CI with caching: define cache paths and keys, use cache policies, see how cache differs from artifacts and cache node_modules and pip.

7

Variables, Secrets and Environments in GitLab CI

Use GitLab CI/CD variables safely: predefined and custom variables, masked and protected values, group-level and scoped variables, and precedence rules.

8

GitLab Runners

Learn what a GitLab Runner is and how it runs jobs: shared versus specific runners, executors, installing and registering on Ubuntu, and a Docker executor.

9

GitLab CI Pipeline Rules

Control exactly when GitLab CI jobs run with rules:if, rules:changes and rules:exists, plus workflow rules, merge request pipelines and manual jobs.

10

GitLab CI Environments

Track deployments with GitLab CI environments: the environment keyword, static versus dynamic environments, review apps, protected environments and approvals.

11

GitLab CI Docker Workflows

Build and push Docker images in GitLab CI: compare Docker-in-Docker with Kaniko, authenticate to the Container Registry, pick tags and follow a full example.

12

GitLab CI Testing

Run tests in GitLab CI: collect JUnit reports, view results in merge requests, extract coverage with a regex, run in parallel and follow a Jest pipeline.

13

GitLab CI Security Scanning

Add security scanning to GitLab CI: SAST, DAST, secret detection, dependency and container scanning, and DevSecOps habits for secure pipelines.

14

GitLab CI Deploy to AWS

Deploy to AWS from GitLab CI using OIDC instead of static keys, then ship to S3 and EC2, push images to ECR, update ECS services and automate Terraform runs.

15

GitLab CI Multi-Project Pipelines

Trigger downstream pipelines in GitLab with the trigger keyword: pass variables, choose strategy depend or mirror, build child pipelines and use include.

16

GitLab CI Best Practices

Speed up GitLab CI pipelines with better caching, DAG execution using needs, reusable include templates, YAML anchors, rules and protected deployments.

GitLab CI/CD Tutorial: common questions

What is CI/CD in simple terms?

Continuous integration automatically builds and tests every change pushed to a repository. Continuous delivery or deployment then ships the tested change to an environment automatically, so releases become small, frequent and repeatable.

Is GitLab CI good for beginners?

Yes. A single .gitlab-ci.yml file defines the whole pipeline, GitLab.com provides shared runners, and the pipeline view shows every stage and job, which makes it a clear way to learn CI/CD concepts.

GitLab CI or GitHub Actions: which should I learn?

Learn whichever your team or target employers use. The concepts, jobs, stages, runners, caching, artifacts and secrets, transfer directly. This site has a separate GitHub Actions tutorial if you want both.