[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-0fa7deba-6fd4-4a24-a763-6ca45392b842":3,"$fTFFKEEzLpA8uH9dmXblclNNfVXxg2QvbkFZ8W4cT5nQ":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"0fa7deba-6fd4-4a24-a763-6ca45392b842","deployment-pipeline-design","多阶段CI\u002FCD流水线架构模式，带有审批门和部署策略。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: deployment-pipeline-design\ndescription: \"Architecture patterns for multi-stage CI\u002FCD pipelines with approval gates and deployment strategies.\"\nrisk: critical\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Deployment Pipeline Design\n\nArchitecture patterns for multi-stage CI\u002FCD pipelines with approval gates and deployment strategies.\n\n## Do not use this skill when\n\n- The task is unrelated to deployment pipeline design\n- You need a different domain or tool outside this scope\n\n## Instructions\n\n- Clarify goals, constraints, and required inputs.\n- Apply relevant best practices and validate outcomes.\n- Provide actionable steps and verification.\n- If detailed examples are required, open `resources\u002Fimplementation-playbook.md`.\n\n## Purpose\n\nDesign robust, secure deployment pipelines that balance speed with safety through proper stage organization and approval workflows.\n\n## Use this skill when\n\n- Design CI\u002FCD architecture\n- Implement deployment gates\n- Configure multi-environment pipelines\n- Establish deployment best practices\n- Implement progressive delivery\n\n## Pipeline Stages\n\n### Standard Pipeline Flow\n\n```\n┌─────────┐   ┌──────┐   ┌─────────┐   ┌────────┐   ┌──────────┐\n│  Build  │ → │ Test │ → │ Staging │ → │ Approve│ → │Production│\n└─────────┘   └──────┘   └─────────┘   └────────┘   └──────────┘\n```\n\n### Detailed Stage Breakdown\n\n1. **Source** - Code checkout\n2. **Build** - Compile, package, containerize\n3. **Test** - Unit, integration, security scans\n4. **Staging Deploy** - Deploy to staging environment\n5. **Integration Tests** - E2E, smoke tests\n6. **Approval Gate** - Manual approval required\n7. **Production Deploy** - Canary, blue-green, rolling\n8. **Verification** - Health checks, monitoring\n9. **Rollback** - Automated rollback on failure\n\n## Approval Gate Patterns\n\n### Pattern 1: Manual Approval\n\n```yaml\n# GitHub Actions\nproduction-deploy:\n  needs: staging-deploy\n  environment:\n    name: production\n    url: https:\u002F\u002Fapp.example.com\n  runs-on: ubuntu-latest\n  steps:\n    - name: Deploy to production\n      run: |\n        # Deployment commands\n```\n\n### Pattern 2: Time-Based Approval\n\n```yaml\n# GitLab CI\ndeploy:production:\n  stage: deploy\n  script:\n    - deploy.sh production\n  environment:\n    name: production\n  when: delayed\n  start_in: 30 minutes\n  only:\n    - main\n```\n\n### Pattern 3: Multi-Approver\n\n```yaml\n# Azure Pipelines\nstages:\n- stage: Production\n  dependsOn: Staging\n  jobs:\n  - deployment: Deploy\n    environment:\n      name: production\n      resourceType: Kubernetes\n    strategy:\n      runOnce:\n        preDeploy:\n          steps:\n          - task: ManualValidation@0\n            inputs:\n              notifyUsers: 'team-leads@example.com'\n              instructions: 'Review staging metrics before approving'\n```\n\n**Reference:** See `assets\u002Fapproval-gate-template.yml`\n\n## Deployment Strategies\n\n### 1. Rolling Deployment\n\n```yaml\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: my-app\nspec:\n  replicas: 10\n  strategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxSurge: 2\n      maxUnavailable: 1\n```\n\n**Characteristics:**\n- Gradual rollout\n- Zero downtime\n- Easy rollback\n- Best for most applications\n\n### 2. Blue-Green Deployment\n\n```yaml\n# Blue (current)\nkubectl apply -f blue-deployment.yaml\nkubectl label service my-app version=blue\n\n# Green (new)\nkubectl apply -f green-deployment.yaml\n# Test green environment\nkubectl label service my-app version=green\n\n# Rollback if needed\nkubectl label service my-app version=blue\n```\n\n**Characteristics:**\n- Instant switchover\n- Easy rollback\n- Doubles infrastructure cost temporarily\n- Good for high-risk deployments\n\n### 3. Canary Deployment\n\n```yaml\napiVersion: argoproj.io\u002Fv1alpha1\nkind: Rollout\nmetadata:\n  name: my-app\nspec:\n  replicas: 10\n  strategy:\n    canary:\n      steps:\n      - setWeight: 10\n      - pause: {duration: 5m}\n      - setWeight: 25\n      - pause: {duration: 5m}\n      - setWeight: 50\n      - pause: {duration: 5m}\n      - setWeight: 100\n```\n\n**Characteristics:**\n- Gradual traffic shift\n- Risk mitigation\n- Real user testing\n- Requires service mesh or similar\n\n### 4. Feature Flags\n\n```python\nfrom flagsmith import Flagsmith\n\nflagsmith = Flagsmith(environment_key=\"API_KEY\")\n\nif flagsmith.has_feature(\"new_checkout_flow\"):\n    # New code path\n    process_checkout_v2()\nelse:\n    # Existing code path\n    process_checkout_v1()\n```\n\n**Characteristics:**\n- Deploy without releasing\n- A\u002FB testing\n- Instant rollback\n- Granular control\n\n## Pipeline Orchestration\n\n### Multi-Stage Pipeline Example\n\n```yaml\nname: Production Pipeline\n\non:\n  push:\n    branches: [ main ]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - name: Build application\n        run: make build\n      - name: Build Docker image\n        run: docker build -t myapp:${{ github.sha }} .\n      - name: Push to registry\n        run: docker push myapp:${{ github.sha }}\n\n  test:\n    needs: build\n    runs-on: ubuntu-latest\n    steps:\n      - name: Unit tests\n        run: make test\n      - name: Security scan\n        run: trivy image myapp:${{ github.sha }}\n\n  deploy-staging:\n    needs: test\n    runs-on: ubuntu-latest\n    environment:\n      name: staging\n    steps:\n      - name: Deploy to staging\n        run: kubectl apply -f k8s\u002Fstaging\u002F\n\n  integration-test:\n    needs: deploy-staging\n    runs-on: ubuntu-latest\n    steps:\n      - name: Run E2E tests\n        run: npm run test:e2e\n\n  deploy-production:\n    needs: integration-test\n    runs-on: ubuntu-latest\n    environment:\n      name: production\n    steps:\n      - name: Canary deployment\n        run: |\n          kubectl apply -f k8s\u002Fproduction\u002F\n          kubectl argo rollouts promote my-app\n\n  verify:\n    needs: deploy-production\n    runs-on: ubuntu-latest\n    steps:\n      - name: Health check\n        run: curl -f https:\u002F\u002Fapp.example.com\u002Fhealth\n      - name: Notify team\n        run: |\n          curl -X POST ${{ secrets.SLACK_WEBHOOK }} \\\n            -d '{\"text\":\"Production deployment successful!\"}'\n```\n\n## Pipeline Best Practices\n\n1. **Fail fast** - Run quick tests first\n2. **Parallel execution** - Run independent jobs concurrently\n3. **Caching** - Cache dependencies between runs\n4. **Artifact management** - Store build artifacts\n5. **Environment parity** - Keep environments consistent\n6. **Secrets management** - Use secret stores (Vault, etc.)\n7. **Deployment windows** - Schedule deployments appropriately\n8. **Monitoring integration** - Track deployment metrics\n9. **Rollback automation** - Auto-rollback on failures\n10. **Documentation** - Document pipeline stages\n\n## Rollback Strategies\n\n### Automated Rollback\n\n```yaml\ndeploy-and-verify:\n  steps:\n    - name: Deploy new version\n      run: kubectl apply -f k8s\u002F\n\n    - name: Wait for rollout\n      run: kubectl rollout status deployment\u002Fmy-app\n\n    - name: Health check\n      id: health\n      run: |\n        for i in {1..10}; do\n          if curl -sf https:\u002F\u002Fapp.example.com\u002Fhealth; then\n            exit 0\n          fi\n          sleep 10\n        done\n        exit 1\n\n    - name: Rollback on failure\n      if: failure()\n      run: kubectl rollout undo deployment\u002Fmy-app\n```\n\n### Manual Rollback\n\n```bash\n# List revision history\nkubectl rollout history deployment\u002Fmy-app\n\n# Rollback to previous version\nkubectl rollout undo deployment\u002Fmy-app\n\n# Rollback to specific revision\nkubectl rollout undo deployment\u002Fmy-app --to-revision=3\n```\n\n## Monitoring and Metrics\n\n### Key Pipeline Metrics\n\n- **Deployment Frequency** - How often deployments occur\n- **Lead Time** - Time from commit to production\n- **Change Failure Rate** - Percentage of failed deployments\n- **Mean Time to Recovery (MTTR)** - Time to recover from failure\n- **Pipeline Success Rate** - Percentage of successful runs\n- **Average Pipeline Duration** - Time to complete pipeline\n\n### Integration with Monitoring\n\n```yaml\n- name: Post-deployment verification\n  run: |\n    # Wait for metrics stabilization\n    sleep 60\n\n    # Check error rate\n    ERROR_RATE=$(curl -s \"$PROMETHEUS_URL\u002Fapi\u002Fv1\u002Fquery?query=rate(http_errors_total[5m])\" | jq '.data.result[0].value[1]')\n\n    if (( $(echo \"$ERROR_RATE > 0.01\" | bc -l) )); then\n      echo \"Error rate too high: $ERROR_RATE\"\n      exit 1\n    fi\n```\n\n## Reference Files\n\n- `references\u002Fpipeline-orchestration.md` - Complex pipeline patterns\n- `assets\u002Fapproval-gate-template.yml` - Approval workflow templates\n\n## Related Skills\n\n- `github-actions-templates` - For GitHub Actions implementation\n- `gitlab-ci-patterns` - For GitLab CI implementation\n- `secrets-management` - For secrets handling\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,141,2041,"2026-05-16 13:15:03",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"672fc40a-902a-4f89-9e54-473c739439bc","1.0.0","deployment-pipeline-design.zip",3500,"uploads\u002Fskills\u002F0fa7deba-6fd4-4a24-a763-6ca45392b842\u002Fdeployment-pipeline-design.zip","633f067df311a2ccc67a55d3a6e863ab243e3b3af590f9f4719cc62234066e47","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":9133}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]