Pipeline Stages

Define sequential or parallel execution stages.

Stage Types

  • Build - Compile code, create artifacts
  • Test - Run unit, integration tests
  • Security - Scan for vulnerabilities
  • Deploy - Deploy to environment
  • Notify - Send notifications

Stage Configuration

stages:
  - name: Build
    image: node:18
    timeout: 10m
    cache:
      paths: [node_modules/]
    steps:
      - run: npm ci
      - run: npm run build

  - name: Deploy Staging
    needs: [Build]
    environment: staging
    steps:
      - deploy: staging-app

  - name: Deploy Production
    needs: [Deploy Staging]
    environment: production
    manual: true  # Requires manual approval
    steps:
      - deploy: prod-app

Artifacts

# Upload artifact
- artifact:
    name: build-output
    path: dist/

# Download in later stage
- download:
    artifact: build-output
    path: ./dist