ci-cd-patternslisted
Install: claude install-skill Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack
# CI/CD Patterns
## Pipeline Stages (Universal)
```
1. Lint / Format Check
2. Unit Tests
3. Build Artifact / Docker Image
4. Integration Tests
5. Security Scan (SAST/SCA)
6. Push to Registry
7. Deploy to Staging
8. Smoke Tests
9. Deploy to Production (manual gate or auto)
10. Post-deploy Health Check
```
## Blue-Green Deployment
```bash
# Two identical environments; switch traffic at load balancer
# Blue = current live, Green = new version
# 1. Deploy new version to Green
kubectl apply -f deployment-green.yaml
# 2. Wait for Green to be ready
kubectl rollout status deployment/myapp-green
# 3. Run smoke tests against Green
./scripts/smoke-test.sh https://green.internal
# 4. Switch traffic (update Service selector)
kubectl patch service myapp -p '{"spec":{"selector":{"version":"green"}}}'
# 5. Monitor — rollback in seconds if needed
kubectl patch service myapp -p '{"spec":{"selector":{"version":"blue"}}}'
```
## Canary Deployment (nginx ingress)
```yaml
# 90% → stable, 10% → canary
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myapp-canary
annotations:
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "10"
spec:
rules:
- host: myapp.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: myapp-canary
port:
number: 80
```
## Rolling Deployment (Kubernetes)
```yaml
str