Design multi-stage CI/CD pipelines with approval gates, security checks, and deployment orchestration. Use when architecting deployment workflows, setting up continuous delivery, or implementing GitOps practices.
Add this skill
npx mdskills install sickn33/deployment-pipeline-designComprehensive CI/CD pipeline design with multiple deployment strategies, approval patterns, and rollback procedures
1---2name: deployment-pipeline-design3description: Design multi-stage CI/CD pipelines with approval gates, security checks, and deployment orchestration. Use when architecting deployment workflows, setting up continuous delivery, or implementing GitOps practices.4---56# Deployment Pipeline Design78Architecture patterns for multi-stage CI/CD pipelines with approval gates and deployment strategies.910## Do not use this skill when1112- The task is unrelated to deployment pipeline design13- You need a different domain or tool outside this scope1415## Instructions1617- Clarify goals, constraints, and required inputs.18- Apply relevant best practices and validate outcomes.19- Provide actionable steps and verification.20- If detailed examples are required, open `resources/implementation-playbook.md`.2122## Purpose2324Design robust, secure deployment pipelines that balance speed with safety through proper stage organization and approval workflows.2526## Use this skill when2728- Design CI/CD architecture29- Implement deployment gates30- Configure multi-environment pipelines31- Establish deployment best practices32- Implement progressive delivery3334## Pipeline Stages3536### Standard Pipeline Flow3738```39┌─────────┐ ┌──────┐ ┌─────────┐ ┌────────┐ ┌──────────┐40│ Build │ → │ Test │ → │ Staging │ → │ Approve│ → │Production│41└─────────┘ └──────┘ └─────────┘ └────────┘ └──────────┘42```4344### Detailed Stage Breakdown45461. **Source** - Code checkout472. **Build** - Compile, package, containerize483. **Test** - Unit, integration, security scans494. **Staging Deploy** - Deploy to staging environment505. **Integration Tests** - E2E, smoke tests516. **Approval Gate** - Manual approval required527. **Production Deploy** - Canary, blue-green, rolling538. **Verification** - Health checks, monitoring549. **Rollback** - Automated rollback on failure5556## Approval Gate Patterns5758### Pattern 1: Manual Approval5960```yaml61# GitHub Actions62production-deploy:63 needs: staging-deploy64 environment:65 name: production66 url: https://app.example.com67 runs-on: ubuntu-latest68 steps:69 - name: Deploy to production70 run: |71 # Deployment commands72```7374### Pattern 2: Time-Based Approval7576```yaml77# GitLab CI78deploy:production:79 stage: deploy80 script:81 - deploy.sh production82 environment:83 name: production84 when: delayed85 start_in: 30 minutes86 only:87 - main88```8990### Pattern 3: Multi-Approver9192```yaml93# Azure Pipelines94stages:95- stage: Production96 dependsOn: Staging97 jobs:98 - deployment: Deploy99 environment:100 name: production101 resourceType: Kubernetes102 strategy:103 runOnce:104 preDeploy:105 steps:106 - task: ManualValidation@0107 inputs:108 notifyUsers: 'team-leads@example.com'109 instructions: 'Review staging metrics before approving'110```111112**Reference:** See `assets/approval-gate-template.yml`113114## Deployment Strategies115116### 1. Rolling Deployment117118```yaml119apiVersion: apps/v1120kind: Deployment121metadata:122 name: my-app123spec:124 replicas: 10125 strategy:126 type: RollingUpdate127 rollingUpdate:128 maxSurge: 2129 maxUnavailable: 1130```131132**Characteristics:**133- Gradual rollout134- Zero downtime135- Easy rollback136- Best for most applications137138### 2. Blue-Green Deployment139140```yaml141# Blue (current)142kubectl apply -f blue-deployment.yaml143kubectl label service my-app version=blue144145# Green (new)146kubectl apply -f green-deployment.yaml147# Test green environment148kubectl label service my-app version=green149150# Rollback if needed151kubectl label service my-app version=blue152```153154**Characteristics:**155- Instant switchover156- Easy rollback157- Doubles infrastructure cost temporarily158- Good for high-risk deployments159160### 3. Canary Deployment161162```yaml163apiVersion: argoproj.io/v1alpha1164kind: Rollout165metadata:166 name: my-app167spec:168 replicas: 10169 strategy:170 canary:171 steps:172 - setWeight: 10173 - pause: {duration: 5m}174 - setWeight: 25175 - pause: {duration: 5m}176 - setWeight: 50177 - pause: {duration: 5m}178 - setWeight: 100179```180181**Characteristics:**182- Gradual traffic shift183- Risk mitigation184- Real user testing185- Requires service mesh or similar186187### 4. Feature Flags188189```python190from flagsmith import Flagsmith191192flagsmith = Flagsmith(environment_key="API_KEY")193194if flagsmith.has_feature("new_checkout_flow"):195 # New code path196 process_checkout_v2()197else:198 # Existing code path199 process_checkout_v1()200```201202**Characteristics:**203- Deploy without releasing204- A/B testing205- Instant rollback206- Granular control207208## Pipeline Orchestration209210### Multi-Stage Pipeline Example211212```yaml213name: Production Pipeline214215on:216 push:217 branches: [ main ]218219jobs:220 build:221 runs-on: ubuntu-latest222 steps:223 - uses: actions/checkout@v4224 - name: Build application225 run: make build226 - name: Build Docker image227 run: docker build -t myapp:${{ github.sha }} .228 - name: Push to registry229 run: docker push myapp:${{ github.sha }}230231 test:232 needs: build233 runs-on: ubuntu-latest234 steps:235 - name: Unit tests236 run: make test237 - name: Security scan238 run: trivy image myapp:${{ github.sha }}239240 deploy-staging:241 needs: test242 runs-on: ubuntu-latest243 environment:244 name: staging245 steps:246 - name: Deploy to staging247 run: kubectl apply -f k8s/staging/248249 integration-test:250 needs: deploy-staging251 runs-on: ubuntu-latest252 steps:253 - name: Run E2E tests254 run: npm run test:e2e255256 deploy-production:257 needs: integration-test258 runs-on: ubuntu-latest259 environment:260 name: production261 steps:262 - name: Canary deployment263 run: |264 kubectl apply -f k8s/production/265 kubectl argo rollouts promote my-app266267 verify:268 needs: deploy-production269 runs-on: ubuntu-latest270 steps:271 - name: Health check272 run: curl -f https://app.example.com/health273 - name: Notify team274 run: |275 curl -X POST ${{ secrets.SLACK_WEBHOOK }} \276 -d '{"text":"Production deployment successful!"}'277```278279## Pipeline Best Practices2802811. **Fail fast** - Run quick tests first2822. **Parallel execution** - Run independent jobs concurrently2833. **Caching** - Cache dependencies between runs2844. **Artifact management** - Store build artifacts2855. **Environment parity** - Keep environments consistent2866. **Secrets management** - Use secret stores (Vault, etc.)2877. **Deployment windows** - Schedule deployments appropriately2888. **Monitoring integration** - Track deployment metrics2899. **Rollback automation** - Auto-rollback on failures29010. **Documentation** - Document pipeline stages291292## Rollback Strategies293294### Automated Rollback295296```yaml297deploy-and-verify:298 steps:299 - name: Deploy new version300 run: kubectl apply -f k8s/301302 - name: Wait for rollout303 run: kubectl rollout status deployment/my-app304305 - name: Health check306 id: health307 run: |308 for i in {1..10}; do309 if curl -sf https://app.example.com/health; then310 exit 0311 fi312 sleep 10313 done314 exit 1315316 - name: Rollback on failure317 if: failure()318 run: kubectl rollout undo deployment/my-app319```320321### Manual Rollback322323```bash324# List revision history325kubectl rollout history deployment/my-app326327# Rollback to previous version328kubectl rollout undo deployment/my-app329330# Rollback to specific revision331kubectl rollout undo deployment/my-app --to-revision=3332```333334## Monitoring and Metrics335336### Key Pipeline Metrics337338- **Deployment Frequency** - How often deployments occur339- **Lead Time** - Time from commit to production340- **Change Failure Rate** - Percentage of failed deployments341- **Mean Time to Recovery (MTTR)** - Time to recover from failure342- **Pipeline Success Rate** - Percentage of successful runs343- **Average Pipeline Duration** - Time to complete pipeline344345### Integration with Monitoring346347```yaml348- name: Post-deployment verification349 run: |350 # Wait for metrics stabilization351 sleep 60352353 # Check error rate354 ERROR_RATE=$(curl -s "$PROMETHEUS_URL/api/v1/query?query=rate(http_errors_total[5m])" | jq '.data.result[0].value[1]')355356 if (( $(echo "$ERROR_RATE > 0.01" | bc -l) )); then357 echo "Error rate too high: $ERROR_RATE"358 exit 1359 fi360```361362## Reference Files363364- `references/pipeline-orchestration.md` - Complex pipeline patterns365- `assets/approval-gate-template.yml` - Approval workflow templates366367## Related Skills368369- `github-actions-templates` - For GitHub Actions implementation370- `gitlab-ci-patterns` - For GitLab CI implementation371- `secrets-management` - For secrets handling372
Full transparency — inspect the skill content before installing.