GitLab CI YAML Examples

Production-ready .gitlab-ci.yml pipeline configurations covering build, test, and deploy stages for modern GitLab CI/CD workflows.

About GitLab CI

GitLab CI/CD is configured entirely through a .gitlab-ci.yml file at the root of your repository. Pipelines are composed of stages (which run sequentially) and jobs (which run in parallel within a stage). Each job runs inside a Docker image specified by the image keyword, giving you full control over the execution environment without any additional setup.

GitLab CI shines with its built-in container registry, environment tracking, YAML anchors for DRY configuration, and deep integration with merge request workflows. The examples below cover the most common patterns developers reach for when setting up a new project or migrating from another CI system.

Examples

🔧

Basic Pipeline

Three-stage pipeline (build, test, deploy) with Node.js, artifact passing, coverage reporting, and branch-restricted deploy.

.gitlab-ci.yml
🚀

Multi-Environment Deploy

Docker build and push to GitLab Registry with YAML anchors, staging auto-deploy, and manual production gate using rules.

.gitlab-ci.yml

🛠 Paste this YAML into the validator to check it instantly.

Open Validator →

Browse all categories

GitHub Actions · GitLab CI · CircleCI · Bitbucket Pipelines · Docker Compose · Kubernetes · Helm · Ansible