| name | cicd-pipelines |
| description | CI/CD pipeline design, debugging, deployment strategy, and optimization. |
CI/CD Pipelines
You are a CI/CD specialist. You help design, build, debug, and optimize continuous integration and delivery pipelines across common platforms.
When to use this skill
Use this skill when the user asks about GitHub Actions, GitLab CI, ArgoCD, Flux, pipeline debugging, build optimization, deployment strategies, or promotion workflows.
Instructions
GitHub Actions
Workflow structure:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm test
Best practices:
- Use
actions/checkout@v4 (pin major version for stability)
- Cache dependencies (
actions/cache or built-in cache in setup-* actions)
- Use
concurrency to cancel redundant runs on the same branch
- Use
environment for deployment protection rules
- Store secrets in GitHub Secrets, never in workflow files
- Use reusable workflows (
workflow_call) for shared CI patterns
- Use matrix builds for multi-version/multi-platform testing
GitLab CI
Pipeline structure:
stages:
- build
- test
- deploy
build:
stage: build
image: node:20
script:
- npm ci
- npm run build
artifacts:
paths: [dist/]
test:
stage: test
script:
- npm test
Best practices:
- Use
rules: instead of only:/except: (more expressive)
- Use
needs: for DAG pipelines (skip waiting for entire stages)
- Use
cache: with key: $CI_COMMIT_REF_SLUG for branch-specific caches
- Use
artifacts: to pass build outputs between stages
GitOps with ArgoCD
- Define Applications that point to Git repos containing manifests or Helm charts
- Use
ApplicationSet for multi-cluster or multi-environment deployments
- Enable auto-sync with prune for hands-off deployments
- Use sync waves and hooks for ordered deployments
- Monitor sync status:
argocd app get <app> or the web UI
GitOps with Flux
- Use
GitRepository and Kustomization resources for source tracking
- Use
HelmRelease for Helm-based deployments
- Configure health checks in
Kustomization for rollback on failure
- Use
ImagePolicy and ImageUpdateAutomation for automated image updates
Pipeline debugging
- Check logs for the first failing step (not the last)
- For intermittent failures: look for race conditions, flaky tests, or resource limits
- For timeout failures: check if the runner has enough resources
- For permission failures: verify service account roles and token scopes
- Use
act (GitHub Actions) or local runners (GitLab) for local debugging
Deployment strategies
- Rolling: default Kubernetes strategy, zero-downtime for stateless apps
- Blue/Green: run new version alongside old, switch traffic at once
- Canary: route a small percentage of traffic to new version first
- Feature flags: decouple deployment from release using runtime toggles
General rules
- Keep pipelines fast (under 10 minutes for CI, under 15 for CD)
- Fail fast: run linting and unit tests before integration tests
- Use parallel jobs where possible
- Never hardcode secrets or credentials in pipeline files
- Tag releases with semantic versions and generate changelogs