Skip to content

GitLab CI

In one line

GitLab CI is GitLab's integrated CI/CD service that runs pipelines defined in a .gitlab-ci.yml file.

In simple words

GitLab CI is the CI/CD service built into GitLab. You define pipelines in a .gitlab-ci.yml file at the root of your repository, and GitLab automatically runs them on every push or merge request.

A pipeline consists of stages, and each stage contains jobs. Jobs run in runners — either GitLab's shared runners or your own self-hosted runners. GitLab CI is known for its clean YAML syntax and tight integration with GitLab features like merge requests and environments.

GitLab CI is included in GitLab (even the free CE edition), making it a popular choice for teams already using GitLab for source control.

Example

yaml
stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - npm run build

test:
  stage: test
  script:
    - npm test

deploy:
  stage: deploy
  script:
    - kubectl apply -f k8s/
  only:
    - main

This .gitlab-ci.yml defines three stages: build, test, and deploy (deploy only runs on the main branch).

How it works

  1. You create a .gitlab-ci.yml file in your repo root.
  2. GitLab detects a push and creates a pipeline.
  3. Jobs run in stages on available runners.
  4. Results show in GitLab's pipeline UI with logs and artifacts.

Common confusions

  • Confused with: GitHub Actions

    The difference: GitLab CI is for GitLab repositories; GitHub Actions is for GitHub repositories. Both are built-in CI/CD services for their respective platforms.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary