DevOps Engineer

CI/CD Pipeline That Actually Works β€” From Push to Production in 12 Minutes

12min pipeline vs 25min unoptimizedDevOps & Cloud4 min read

Key Takeaway

The CI/CD skill generates complete pipeline configurations for GitHub Actions, GitLab CI, or Jenkins β€” with proper stages, caching, parallel testing, security scanning, and deployment gates. One prompt, zero YAML trial-and-error.

The Problem

Every CI/CD pipeline starts the same way:

  1. Copy a "starter template" from the docs
  2. Realize it doesn't cover your stack
  3. Spend 3 hours getting the build step to work
  4. Spend 2 hours on caching (because builds take 15 minutes without it)
  5. Spend 1 hour on test parallelization
  6. Never add security scanning ("we'll do it later")
  7. Deployment is a manual step or a sketchy script
  8. Pipeline takes 25 minutes. Nobody fixes it.

A well-designed pipeline: build β†’ test (parallel) β†’ security scan β†’ staging deploy β†’ integration test β†’ production deploy with rollback. Takes a senior DevOps engineer a full day to set up properly.

The Solution

The CI/CD skill generates complete pipeline configurations optimized for your stack, with proper caching, parallelization, security stages, and deployment strategies.

The Process

View details
You: Create a GitLab CI pipeline for our monorepo:
- Frontend: Next.js (deploy to Vercel)
- Backend: Django + Python 3.12 (deploy to Render)
- Shared: PostgreSQL tests need a service container
- Want: lint, test (parallel), security scan, deploy staging,
  deploy prod (manual gate)

The agent generates a complete .gitlab-ci.yml:

yamlShow code
stages:
  - validate
  - test
  - security
  - build
  - deploy-staging
  - integration
  - deploy-production

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
  NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm-cache"
  POSTGRES_DB: test_db
  POSTGRES_USER: test_user
  POSTGRES_PASSWORD: test_pass

# === VALIDATE STAGE ===
lint:frontend:
  stage: validate
  image: node:20-alpine
  cache:
    key: npm-${CI_COMMIT_REF_SLUG}
    paths: [.npm-cache, frontend/node_modules]
  script:
    - cd frontend && npm ci --cache .npm-cache
    - npm run lint
    - npm run type-check
  rules:
    - changes: [frontend/**/*]

lint:backend:
  stage: validate
  image: python:3.12-slim
  cache:
    key: pip-${CI_COMMIT_REF_SLUG}
    paths: [.pip-cache]
  script:
    - cd backend && pip install ruff
    - ruff check .
    - ruff format --check .
  rules:
    - changes: [backend/**/*]

# === TEST STAGE (parallel) ===
test:frontend:
  stage: test
  image: node:20-alpine
  cache:
    key: npm-${CI_COMMIT_REF_SLUG}
    paths: [.npm-cache, frontend/node_modules]
  script:
    - cd frontend && npm ci
    - npm run test -- --coverage --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
  parallel: 3
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: frontend/coverage/cobertura-coverage.xml

test:backend:
  stage: test
  image: python:3.12-slim
  services:
    - postgres:16-alpine
  variables:
    DATABASE_URL: "postgresql://test_user:test_pass@postgres:5432/test_db"
  cache:
    key: pip-${CI_COMMIT_REF_SLUG}
    paths: [.pip-cache]
  script:
    - cd backend && pip install -r requirements.txt
    - pytest --cov --cov-report=xml -n auto
  parallel: 2
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: backend/coverage.xml

# === SECURITY STAGE ===
sast:
  stage: security
  image: returntocorp/semgrep
  script:
    - semgrep scan --config=auto --sarif -o semgrep.sarif .
  artifacts:
    reports:
      sast: semgrep.sarif
  allow_failure: true

dependency-scan:
  stage: security
  image: python:3.12-slim
  script:
    - pip install safety pip-audit
    - cd backend && pip-audit -r requirements.txt
    - cd ../frontend && npx audit-ci --moderate
  allow_failure: true

# === BUILD ===
build:frontend:
  stage: build
  image: node:20-alpine
  script:
    - cd frontend && npm ci && npm run build
  artifacts:
    paths: [frontend/.next]
    expire_in: 1 hour

# === DEPLOY STAGING ===
deploy:staging:frontend:
  stage: deploy-staging
  image: node:20-alpine
  script:
    - npx vercel --token=$VERCEL_TOKEN --prod=false
  environment:
    name: staging
    url: https://staging.myapp.com
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

deploy:staging:backend:
  stage: deploy-staging
  script:
    - curl -X POST "https://api.render.com/deploy/srv-${RENDER_SERVICE_ID}?key=${RENDER_API_KEY}"
  environment:
    name: staging-api

# === INTEGRATION TESTS ===
integration:
  stage: integration
  image: node:20-alpine
  script:
    - cd frontend && npx playwright install --with-deps
    - npx playwright test --project=staging
  artifacts:
    when: always
    paths: [frontend/test-results]

# === DEPLOY PRODUCTION (manual gate) ===
deploy:prod:frontend:
  stage: deploy-production
  script:
    - npx vercel --token=$VERCEL_TOKEN --prod
  environment:
    name: production
    url: https://myapp.com
  when: manual
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

deploy:prod:backend:
  stage: deploy-production
  script:
    - curl -X POST "https://api.render.com/deploy/srv-${RENDER_PROD_ID}?key=${RENDER_API_KEY}"
  environment:
    name: production-api
  when: manual

Pipeline execution time:

Without optimizationWith agent optimization
25 minutes (sequential)12 minutes (parallel + cached)

The Results

MetricTrial-and-ErrorAI Agent
Setup time6-8 hours15 minutes
CachingUsually brokenProperly configured
Test parallelizationRareBuilt-in
Security scanning"Later" (never)Included
Deployment gatesMissingManual approval stage
Pipeline duration20-30 min10-15 min

Setup on MrChief

yamlShow code
skills:
  - ci-cd
  - docker   # For build stages
  - testing  # For test strategy
cicdgitlab-cipipelinedeploymentautomation

Want results like these?

Start free with your own AI team. No credit card required.

CI/CD Pipeline That Actually Works β€” From Push to Production in 12 Minutes β€” Mr.Chief