Labs ICT
⭐ Pro Login

GitLab CI

Built-in CI/CD pipelines in the GitLab platform

GitLab CI

GitLab CI/CD is built directly into the GitLab platform. It provides a complete DevOps lifecycle in a single application with no external tools needed.

Pipeline Configuration


  # .gitlab-ci.yml
  stages:
    - build
    - test
    - deploy

  build:
    stage: build
    image: node:20
    script:
      - npm ci
      - npm run build
    artifacts:
      paths:
        - dist/

  test:
    stage: test
    image: node:20
    script:
      - npm ci
      - npm test
    coverage: '/All files\s*\|\s*([\d\.]+)/'

  deploy_staging:
    stage: deploy
    image: alpine:latest
    script:
      - apk add --no-cache openssh-client
      - ssh deploy@staging "cd /app && git pull && pm2 restart all"
    only:
      - main
    when: manual

GitLab CI Key Concepts

  • Stages β€” Define pipeline phases (build, test, deploy)
  • Jobs β€” Individual tasks within a stage
  • Runners β€” Agents that execute jobs (shared or specific)
  • Artifacts β€” Files produced by jobs (binaries, reports)
  • Cache β€” Speed up builds by caching dependencies

GitLab CI Features


  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚        GitLab CI/CD Features            β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚  Auto DevOps    β€” Auto-detect & build   β”‚
  β”‚  Environments  β€” Track deployments      β”‚
  β”‚  Review Apps   β€” Per-branch previews    β”‚
  β”‚  Container Registry β€” Built-in registry β”‚
  β”‚  Security Scans β€” SAST, DAST, dependencyβ”‚
  β”‚  Metrics       β€” Monitor deployments    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ§ͺ Quick Quiz

Where is the GitLab CI pipeline configuration defined?