GitLab CI/CD is a built-in continuous integration and continuous deployment platform that automates the entire software development lifecycle — from building and testing code to deploying it to production. Unlike tools that require third-party plugins, GitLab CI/CD is natively integrated into GitLab, enabling teams to define workflows in a single .gitlab-ci.yml file at the repository root. Pipelines can run in Docker containers, on Kubernetes, or on bare-metal; support DAGs, parent-child relationships, and component-based reuse; and use CI/CD inputs for type-safe parameter passing as the modern replacement for plain variables. The key mental model: pipelines are composed of stages, stages contain jobs, and jobs execute scripts — with every aspect configurable through YAML keywords that control execution order, dependencies, caching, artifacts, and deployment strategies.
What This Cheat Sheet Covers
This topic spans 16 focused tables and 149 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core Pipeline Structure
| Keyword | Example | Description |
|---|---|---|
stages: - build - test - deploy | • Defines the ordered sequence of stages • jobs in the same stage run in parallel, stages execute sequentially. | |
build-app: stage: build script: - npm run build | A named job in a specific stage — the fundamental unit of work in a pipeline. | |
script: - echo "Building..." - make build | • Required keyword defining shell commands to execute • each line runs in sequence. | |
before_script: - apt-get update - apt-get install -y curl | • Commands that run before the main script• commonly used for environment setup. | |
after_script: - rm -rf /tmp/* - cleanup.sh | • Commands that run after the main script completes (even on failure)• used for cleanup. | |
default: image: node:18 cache: paths: [node_modules/] | • Sets default values for all jobs in the pipeline • individual jobs can override. |