[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BMS85WSAVXBBP5HV39J8HM":3,"skill-same:01M7BMS85WSAVXBBP5HV39J8HM":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7BMS85WSAVXBBP5HV39J8HM","deployment-pipeline-design",null,"Design multi-stage CI\u002FCD pipelines with approval gates, security checks, and deployment orchestration. Use this skill when designing zero-downtime deployment pipelines, implementing canary rollout strategies, setting up multi-environment promotion workflows, or debugging failed deployment gates in CI\u002FCD.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Agent-智能体\u002FYYC3-Agent-智能体-agents\u002Fplugins\u002Fcicd-automation\u002Fskills\u002Fdeployment-pipeline-design\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: deployment-pipeline-design\ndescription: Design multi-stage CI\u002FCD pipelines with approval gates, security checks, and deployment orchestration. Use this skill when designing zero-downtime deployment pipelines, implementing canary rollout strategies, setting up multi-environment promotion workflows, or debugging failed deployment gates in CI\u002FCD.\n---\n\n# Deployment Pipeline Design\n\nArchitecture patterns for multi-stage CI\u002FCD pipelines with approval gates, deployment strategies, and environment promotion workflows.\n\n## Purpose\n\nDesign robust, secure deployment pipelines that balance speed with safety through proper stage organization, automated quality gates, and progressive delivery strategies. This skill covers both the structural design of pipeline architecture and the operational patterns for reliable production deployments.\n\n## Input \u002F Output\n\n### What You Provide\n\n- **Application type**: Language\u002Fruntime, containerized or bare-metal, monolith or microservices\n- **Deployment target**: Kubernetes, ECS, VMs, serverless, or platform-as-a-service\n- **Environment topology**: Number of environments (dev\u002Fstaging\u002Fprod), region layout, air-gap requirements\n- **Rollout requirements**: Acceptable downtime, rollback SLA, traffic splitting needs, canary vs blue-green preference\n- **Gate constraints**: Approval teams, required test coverage thresholds, compliance scans (SAST, DAST, SCA)\n- **Monitoring stack**: Prometheus, Datadog, CloudWatch, or other metrics sources used for automated promotion decisions\n\n### What This Skill Produces\n\n- **Pipeline configuration**: Stage definitions, job dependencies, parallelism, and caching strategy\n- **Deployment strategy**: Chosen rollout pattern with annotated configuration (canary weights, blue-green switchover, rolling parameters)\n- **Health check setup**: Shallow vs deep readiness probes, post-deployment smoke test scripts\n- **Gate definitions**: Automated metric thresholds and manual approval workflows\n- **Rollback plan**: Automated rollback triggers and manual runbook steps\n\n## When to Use\n\n- Design CI\u002FCD architecture for a new service or platform migration\n- Implement deployment gates between environments\n- Configure multi-environment pipelines with mandatory security scanning\n- Establish progressive delivery with canary or blue-green strategies\n- Debug pipelines where stages succeed but production behavior is wrong\n- Reduce mean time to recovery by automating rollback on metric degradation\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, dependency graph resolution\n2. **Build** - Compile, package, containerize, sign artifacts\n3. **Test** - Unit, integration, SAST\u002FSCA security scans\n4. **Staging Deploy** - Deploy to staging environment with smoke tests\n5. **Integration Tests** - E2E, contract tests, performance baselines\n6. **Approval Gate** - Manual or automated metric-based gate\n7. **Production Deploy** - Canary, blue-green, or rolling strategy\n8. **Verification** - Deep health checks, synthetic monitoring\n9. **Rollback** - Automated rollback on failure signals\n\n## Approval Gate Patterns\n\n### Pattern 1: Manual Approval (GitHub Actions)\n\n```yaml\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: kubectl apply -f k8s\u002Fproduction\u002F\n```\n\nEnvironment protection rules in GitHub enforce required reviewers before this job starts. Configure reviewers at **Settings → Environments → production → Required reviewers**.\n\n### Pattern 2: Time-Based Approval (GitLab CI)\n\n```yaml\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 (Azure Pipelines)\n\n```yaml\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### Pattern 4: Automated Metric Gate\n\nUse an AnalysisTemplate (Argo Rollouts) or a custom gate script to block promotion when error rates exceed a threshold:\n\n```yaml\n# Argo Rollouts AnalysisTemplate — blocks canary promotion automatically\napiVersion: argoproj.io\u002Fv1alpha1\nkind: AnalysisTemplate\nmetadata:\n  name: success-rate\nspec:\n  metrics:\n  - name: success-rate\n    interval: 60s\n    successCondition: \"result[0] >= 0.95\"\n    failureCondition: \"result[0] \u003C 0.90\"\n    inconclusiveLimit: 3\n    provider:\n      prometheus:\n        address: http:\u002F\u002Fprometheus:9090\n        query: |\n          sum(rate(http_requests_total{status!~\"5..\",job=\"my-app\"}[2m]))\n          \u002F sum(rate(http_requests_total{job=\"my-app\"}[2m]))\n```\n\n## Deployment Strategies\n\n### Decision Table\n\n| Strategy     | Downtime | Rollback Speed | Cost Impact     | Best For                        |\n|-------------|----------|----------------|-----------------|----------------------------------|\n| Rolling      | None     | ~minutes       | None            | Most stateless services          |\n| Blue-Green   | None     | Instant        | 2x infra (temp) | High-risk or database migrations |\n| Canary       | None     | Instant        | Minimal         | High-traffic, metric-driven      |\n| Recreate     | Yes      | Fast           | None            | Dev\u002Ftest, batch jobs             |\n| Feature Flag | None     | Instant        | None            | Gradual feature exposure         |\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         # at most 12 pods during rollout\n      maxUnavailable: 1   # at least 9 pods always serving\n```\n\nCharacteristics: gradual rollout, zero downtime, easy rollback, best for most applications.\n\n### 2. Blue-Green Deployment\n\n```bash\n# Switch traffic from blue to green\nkubectl apply -f k8s\u002Fgreen-deployment.yaml\nkubectl rollout status deployment\u002Fmy-app-green\n\n# Flip the service selector\nkubectl patch service my-app -p '{\"spec\":{\"selector\":{\"version\":\"green\"}}}'\n\n# Rollback instantly if needed\nkubectl patch service my-app -p '{\"spec\":{\"selector\":{\"version\":\"blue\"}}}'\n```\n\nCharacteristics: instant switchover, easy rollback, doubles infrastructure cost temporarily, good for high-risk deployments with long warm-up times.\n\n### 3. Canary Deployment (Argo Rollouts)\n\n```yaml\napiVersion: argoproj.io\u002Fv1alpha1\nkind: Rollout\nmetadata:\n  name: my-app\nspec:\n  replicas: 10\n  strategy:\n    canary:\n      analysis:\n        templates:\n          - templateName: success-rate\n        startingStep: 2\n      steps:\n        - setWeight: 10\n        - pause: { duration: 5m }\n        - setWeight: 25\n        - pause: { duration: 5m }\n        - setWeight: 50\n        - pause: { duration: 10m }\n        - setWeight: 100\n```\n\nCharacteristics: gradual traffic shift, real-user metric validation, automated promotion or rollback, requires Argo Rollouts or a service mesh.\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    process_checkout_v2()\nelse:\n    process_checkout_v1()\n```\n\nCharacteristics: deploy without releasing, A\u002FB testing, instant rollback per user segment, granular control independent of deployment.\n\n## Pipeline Orchestration\n\n### Multi-Stage Pipeline Example (GitHub Actions)\n\n```yaml\nname: Production Pipeline\n\non:\n  push:\n    branches: [main]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    outputs:\n      image: ${{ steps.build.outputs.image }}\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - name: Build and push Docker image\n        id: build\n        run: |\n          IMAGE=myapp:${{ github.sha }}\n          docker build -t $IMAGE .\n          docker push $IMAGE\n          echo \"image=$IMAGE\" >> $GITHUB_OUTPUT\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 ${{ needs.build.outputs.image }}\n\n  deploy-staging:\n    needs: test\n    environment:\n      name: staging\n    runs-on: ubuntu-latest\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    environment:\n      name: production        # blocks here until required reviewers approve\n    runs-on: ubuntu-latest\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: Deep health check\n        run: |\n          for i in {1..12}; do\n            STATUS=$(curl -sf https:\u002F\u002Fapp.example.com\u002Fhealth\u002Fready | jq -r '.status')\n            [ \"$STATUS\" = \"ok\" ] && exit 0\n            sleep 10\n          done\n          exit 1\n      - name: Notify on success\n        run: |\n          curl -X POST ${{ secrets.SLACK_WEBHOOK }} \\\n            -d '{\"text\":\"Production deployment successful: ${{ github.sha }}\"}'\n```\n\n## Health Checks\n\n### Shallow vs Deep Health Endpoints\n\nA shallow `\u002Fping` returns 200 even when downstream dependencies are broken. Use a deep readiness endpoint that verifies actual dependencies before promoting traffic.\n\n```python\n# \u002Fhealth\u002Fready — checks real dependencies, used by pipeline gate\n@app.get(\"\u002Fhealth\u002Fready\")\nasync def readiness():\n    checks = {\n        \"database\": await check_db_connection(),\n        \"cache\":    await check_redis_connection(),\n        \"queue\":    await check_queue_connection(),\n    }\n    status = \"ok\" if all(checks.values()) else \"degraded\"\n    code = 200 if status == \"ok\" else 503\n    return JSONResponse({\"status\": status, \"checks\": checks}, status_code=code)\n```\n\n### Post-Deployment Verification Script\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\n# verify-deployment.sh — run after every production deploy\nset -euo pipefail\n\nENDPOINT=\"${1:?usage: verify-deployment.sh \u003Cbase-url>}\"\nMAX_ATTEMPTS=12\nSLEEP_SECONDS=10\n\nfor i in $(seq 1 $MAX_ATTEMPTS); do\n  STATUS=$(curl -sf \"$ENDPOINT\u002Fhealth\u002Fready\" | jq -r '.status' 2>\u002Fdev\u002Fnull || echo \"unreachable\")\n  if [ \"$STATUS\" = \"ok\" ]; then\n    echo \"Health check passed after $((i * SLEEP_SECONDS))s\"\n    exit 0\n  fi\n  echo \"Attempt $i\u002F$MAX_ATTEMPTS: status=$STATUS — retrying in ${SLEEP_SECONDS}s\"\n  sleep \"$SLEEP_SECONDS\"\ndone\n\necho \"Health check failed after $((MAX_ATTEMPTS * SLEEP_SECONDS))s\"\nexit 1\n```\n\n## Rollback Strategies\n\n### Automated Rollback in Pipeline\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 --timeout=5m\n\n    - name: Post-deployment health check\n      id: health\n      run: .\u002Fscripts\u002Fverify-deployment.sh https:\u002F\u002Fapp.example.com\n\n    - name: Rollback on failure\n      if: failure()\n      run: |\n        kubectl rollout undo deployment\u002Fmy-app\n        echo \"Rolled back to previous revision\"\n```\n\n### Manual Rollback Commands\n\n```bash\n# List revision history with change-cause annotations\nkubectl rollout history deployment\u002Fmy-app\n\n# Rollback to previous version\nkubectl rollout undo deployment\u002Fmy-app\n\n# Rollback to a specific revision\nkubectl rollout undo deployment\u002Fmy-app --to-revision=3\n\n# Verify rollback completed\nkubectl rollout status deployment\u002Fmy-app\n```\n\nFor advanced rollback strategies including database migration rollbacks and Argo Rollouts abort flows, see [`references\u002Fadvanced-strategies.md`](references\u002Fadvanced-strategies.md).\n\n## Monitoring and Metrics\n\n### Key DORA Metrics to Track\n\n| Metric                    | Target (Elite) | How to Measure                           |\n|--------------------------|----------------|------------------------------------------|\n| Deployment Frequency      | Multiple\u002Fday   | Pipeline run count per day               |\n| Lead Time for Changes     | \u003C 1 hour       | Commit timestamp → production deploy     |\n| Change Failure Rate       | \u003C 5%           | Failed deploys \u002F total deploys           |\n| Mean Time to Recovery     | \u003C 1 hour       | Incident open → service restored         |\n\n### Post-Deployment Metric Verification\n\n```yaml\n- name: Verify error rate post-deployment\n  run: |\n    sleep 60  # allow metrics to accumulate\n\n    ERROR_RATE=$(curl -sf \"$PROMETHEUS_URL\u002Fapi\u002Fv1\u002Fquery\" \\\n      --data-urlencode 'query=sum(rate(http_requests_total{status=~\"5..\"}[5m])) \u002F sum(rate(http_requests_total[5m]))' \\\n      | jq '.data.result[0].value[1]')\n\n    echo \"Current error rate: $ERROR_RATE\"\n    if (( $(echo \"$ERROR_RATE > 0.01\" | bc -l) )); then\n      echo \"Error rate $ERROR_RATE exceeds 1% threshold — triggering rollback\"\n      exit 1\n    fi\n```\n\n## Pipeline Best Practices\n\n1. **Fail fast** — Run quick checks (lint, unit tests) before slow ones (E2E, security scans)\n2. **Parallel execution** — Run independent jobs concurrently to minimize total pipeline time\n3. **Caching** — Cache dependency layers and build artifacts between runs\n4. **Artifact promotion** — Build once, promote the same artifact through all environments\n5. **Environment parity** — Keep staging infrastructure as close to production as possible\n6. **Secrets management** — Use secret stores (Vault, AWS Secrets Manager, GitHub encrypted secrets) — never hardcode\n7. **Deployment windows** — Prefer low-traffic windows; enforce change freeze periods via gate policies\n8. **Idempotent deploys** — Ensure re-running a deploy produces the same result\n9. **Rollback automation** — Trigger rollback automatically on health check or metric threshold failure\n10. **Annotate deployments** — Send deployment markers to monitoring tools (Datadog, Grafana) for correlation\n\n## Troubleshooting\n\n### Health check passes in pipeline but service is unhealthy in production\n\nThe pipeline health check is hitting a shallow `\u002Fping` endpoint that returns 200 even when the database is unreachable. Use a deep readiness check that verifies actual dependencies (see Health Checks section above).\n\n### Canary deployment never promotes to 100%\n\nArgo Rollouts requires a valid `AnalysisTemplate` to auto-promote. If the Prometheus query returns no data (e.g., metric name changed), the analysis stays inconclusive and promotion stalls. Add `inconclusiveLimit` so the rollout fails fast rather than hanging:\n\n```yaml\nspec:\n  metrics:\n  - name: error-rate\n    failureCondition: \"result[0] > 0.05\"\n    inconclusiveLimit: 2   # fail after 2 inconclusive results, not hang indefinitely\n    provider:\n      prometheus:\n        query: |\n          sum(rate(http_requests_total{status=~\"5..\"}[2m]))\n          \u002F sum(rate(http_requests_total[2m]))\n```\n\n### Staging deploy succeeds but production job never starts\n\nCheck that production environment protection rules are configured — a missing reviewer assignment means the approval gate waits indefinitely with no notification. In GitHub Actions, ensure `Required reviewers` is set to an existing user or team in **Settings → Environments → production**.\n\n### Docker layer cache busted on every run causing slow builds\n\nIf `COPY . .` appears before dependency installation, any source file change invalidates the dependency layer. Reorder to copy dependency manifests first:\n\n```dockerfile\n# Good: dependencies cached separately from source code\nCOPY package*.json .\u002F\nRUN npm ci\nCOPY . .\nRUN npm run build\n```\n\n### Rollback leaves database migrations applied to old code\n\nA service rollback without a migration rollback causes schema\u002Fcode mismatch errors. Always make migrations backward-compatible (additive only) for at least one release cycle, and keep undo scripts versioned alongside the migration:\n\n```bash\n# migrations\u002FV20240315__add_nullable_column.sql       (forward)\n# migrations\u002FV20240315__add_nullable_column.undo.sql  (backward)\n```\n\nNever run destructive migrations (DROP COLUMN, ALTER NOT NULL) until the old code version is fully retired from all environments.\n\n## Advanced Topics\n\nFor platform-specific pipeline configurations, multi-region promotion workflows, and advanced Argo Rollouts patterns, see:\n\n- [`references\u002Fadvanced-strategies.md`](references\u002Fadvanced-strategies.md) — Extended YAML examples, platform-specific configs (GitHub Actions, GitLab CI, Azure Pipelines), multi-region canary patterns, and database migration rollback strategies\n\n## Related Skills\n\n- `github-actions-templates` - For GitHub Actions implementation patterns and reusable workflows\n- `gitlab-ci-patterns` - For GitLab CI\u002FCD pipeline implementation\n- `secrets-management` - For secrets handling in CI\u002FCD pipelines\n","# Deployment Pipeline Design\n\nArchitecture patterns for multi-stage CI\u002FCD pipelines with approval gates, deployment strategies, and environment promotion workflows.\n\n## Purpose\n\nDesign robust, secure deployment pipelines that balance speed with safety through proper stage organization, automated quality gates, and progressive delivery strategies. This skill covers both the structural design of pipeline architecture and the operational patterns for reliable production deployments.\n\n## Input \u002F Output\n\n### What You Provide\n\n- **Application type**: Language\u002Fruntime, containerized or bare-metal, monolith or microservices\n- **Deployment target**: Kubernetes, ECS, VMs, serverless, or platform-as-a-service\n- **Environment topology**: Number of environments (dev\u002Fstaging\u002Fprod), region layout, air-gap requirements\n- **Rollout requirements**: Acceptable downtime, rollback SLA, traffic splitting needs, canary vs blue-green preference\n- **Gate constraints**: Approval teams, required test coverage thresholds, compliance scans (SAST, DAST, SCA)\n- **Monitoring stack**: Prometheus, Datadog, CloudWatch, or other metrics sources used for automated promotion decisions\n\n### What This Skill Produces\n\n- **Pipeline configuration**: Stage definitions, job dependencies, parallelism, and caching strategy\n- **Deployment strategy**: Chosen rollout pattern with annotated configuration (canary weights, blue-green switchover, rolling parameters)\n- **Health check setup**: Shallow vs deep readiness probes, post-deployment smoke test scripts\n- **Gate definitions**: Automated metric thresholds and manual approval workflows\n- **Rollback plan**: Automated rollback triggers and manual runbook steps\n\n## When to Use\n\n- Design CI\u002FCD architecture for a new service or platform migration\n- Implement deployment gates between environments\n- Configure multi-environment pipelines with mandatory security scanning\n- Establish progressive delivery with canary or blue-green strategies\n- Debug pipelines where stages succeed but production behavior is wrong\n- Reduce mean time to recovery by automating rollback on metric degradation\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, dependency graph resolution\n2. **Build** - Compile, package, containerize, sign artifacts\n3. **Test** - Unit, integration, SAST\u002FSCA security scans\n4. **Staging Deploy** - Deploy to staging environment with smoke tests\n5. **Integration Tests** - E2E, contract tests, performance baselines\n6. **Approval Gate** - Manual or automated metric-based gate\n7. **Production Deploy** - Canary, blue-green, or rolling strategy\n8. **Verification** - Deep health checks, synthetic monitoring\n9. **Rollback** - Automated rollback on failure signals\n\n## Approval Gate Patterns\n\n### Pattern 1: Manual Approval (GitHub Actions)\n\n```yaml\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: kubectl apply -f k8s\u002Fproduction\u002F\n```\n\nEnvironment protection rules in GitHub enforce required reviewers before this job starts. Configure reviewers at **Settings → Environments → production → Required reviewers**.\n\n### Pattern 2: Time-Based Approval (GitLab CI)\n\n```yaml\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 (Azure Pipelines)\n\n```yaml\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### Pattern 4: Automated Metric Gate\n\nUse an AnalysisTemplate (Argo Rollouts) or a custom gate script to block promotion when error rates exceed a threshold:\n\n```yaml\n# Argo Rollouts AnalysisTemplate — blocks canary promotion automatically\napiVersion: argoproj.io\u002Fv1alpha1\nkind: AnalysisTemplate\nmetadata:\n  name: success-rate\nspec:\n  metrics:\n  - name: success-rate\n    interval: 60s\n    successCondition: \"result[0] >= 0.95\"\n    failureCondition: \"result[0] \u003C 0.90\"\n    inconclusiveLimit: 3\n    provider:\n      prometheus:\n        address: http:\u002F\u002Fprometheus:9090\n        query: |\n          sum(rate(http_requests_total{status!~\"5..\",job=\"my-app\"}[2m]))\n          \u002F sum(rate(http_requests_total{job=\"my-app\"}[2m]))\n```\n\n## Deployment Strategies\n\n### Decision Table\n\n| Strategy     | Downtime | Rollback Speed | Cost Impact     | Best For                        |\n|-------------|----------|----------------|-----------------|----------------------------------|\n| Rolling      | None     | ~minutes       | None            | Most stateless services          |\n| Blue-Green   | None     | Instant        | 2x infra (temp) | High-risk or database migrations |\n| Canary       | None     | Instant        | Minimal         | High-traffic, metric-driven      |\n| Recreate     | Yes      | Fast           | None            | Dev\u002Ftest, batch jobs             |\n| Feature Flag | None     | Instant        | None            | Gradual feature exposure         |\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         # at most 12 pods during rollout\n      maxUnavailable: 1   # at least 9 pods always serving\n```\n\nCharacteristics: gradual rollout, zero downtime, easy rollback, best for most applications.\n\n### 2. Blue-Green Deployment\n\n```bash\n# Switch traffic from blue to green\nkubectl apply -f k8s\u002Fgreen-deployment.yaml\nkubectl rollout status deployment\u002Fmy-app-green\n\n# Flip the service selector\nkubectl patch service my-app -p '{\"spec\":{\"selector\":{\"version\":\"green\"}}}'\n\n# Rollback instantly if needed\nkubectl patch service my-app -p '{\"spec\":{\"selector\":{\"version\":\"blue\"}}}'\n```\n\nCharacteristics: instant switchover, easy rollback, doubles infrastructure cost temporarily, good for high-risk deployments with long warm-up times.\n\n### 3. Canary Deployment (Argo Rollouts)\n\n```yaml\napiVersion: argoproj.io\u002Fv1alpha1\nkind: Rollout\nmetadata:\n  name: my-app\nspec:\n  replicas: 10\n  strategy:\n    canary:\n      analysis:\n        templates:\n          - templateName: success-rate\n        startingStep: 2\n      steps:\n        - setWeight: 10\n        - pause: { duration: 5m }\n        - setWeight: 25\n        - pause: { duration: 5m }\n        - setWeight: 50\n        - pause: { duration: 10m }\n        - setWeight: 100\n```\n\nCharacteristics: gradual traffic shift, real-user metric validation, automated promotion or rollback, requires Argo Rollouts or a service mesh.\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    process_checkout_v2()\nelse:\n    process_checkout_v1()\n```\n\nCharacteristics: deploy without releasing, A\u002FB testing, instant rollback per user segment, granular control independent of deployment.\n\n## Pipeline Orchestration\n\n### Multi-Stage Pipeline Example (GitHub Actions)\n\n```yaml\nname: Production Pipeline\n\non:\n  push:\n    branches: [main]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    outputs:\n      image: ${{ steps.build.outputs.image }}\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - name: Build and push Docker image\n        id: build\n        run: |\n          IMAGE=myapp:${{ github.sha }}\n          docker build -t $IMAGE .\n          docker push $IMAGE\n          echo \"image=$IMAGE\" >> $GITHUB_OUTPUT\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 ${{ needs.build.outputs.image }}\n\n  deploy-staging:\n    needs: test\n    environment:\n      name: staging\n    runs-on: ubuntu-latest\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    environment:\n      name: production        # blocks here until required reviewers approve\n    runs-on: ubuntu-latest\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: Deep health check\n        run: |\n          for i in {1..12}; do\n            STATUS=$(curl -sf https:\u002F\u002Fapp.example.com\u002Fhealth\u002Fready | jq -r '.status')\n            [ \"$STATUS\" = \"ok\" ] && exit 0\n            sleep 10\n          done\n          exit 1\n      - name: Notify on success\n        run: |\n          curl -X POST ${{ secrets.SLACK_WEBHOOK }} \\\n            -d '{\"text\":\"Production deployment successful: ${{ github.sha }}\"}'\n```\n\n## Health Checks\n\n### Shallow vs Deep Health Endpoints\n\nA shallow `\u002Fping` returns 200 even when downstream dependencies are broken. Use a deep readiness endpoint that verifies actual dependencies before promoting traffic.\n\n```python\n# \u002Fhealth\u002Fready — checks real dependencies, used by pipeline gate\n@app.get(\"\u002Fhealth\u002Fready\")\nasync def readiness():\n    checks = {\n        \"database\": await check_db_connection(),\n        \"cache\":    await check_redis_connection(),\n        \"queue\":    await check_queue_connection(),\n    }\n    status = \"ok\" if all(checks.values()) else \"degraded\"\n    code = 200 if status == \"ok\" else 503\n    return JSONResponse({\"status\": status, \"checks\": checks}, status_code=code)\n```\n\n### Post-Deployment Verification Script\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\n# verify-deployment.sh — run after every production deploy\nset -euo pipefail\n\nENDPOINT=\"${1:?usage: verify-deployment.sh \u003Cbase-url>}\"\nMAX_ATTEMPTS=12\nSLEEP_SECONDS=10\n\nfor i in $(seq 1 $MAX_ATTEMPTS); do\n  STATUS=$(curl -sf \"$ENDPOINT\u002Fhealth\u002Fready\" | jq -r '.status' 2>\u002Fdev\u002Fnull || echo \"unreachable\")\n  if [ \"$STATUS\" = \"ok\" ]; then\n    echo \"Health check passed after $((i * SLEEP_SECONDS))s\"\n    exit 0\n  fi\n  echo \"Attempt $i\u002F$MAX_ATTEMPTS: status=$STATUS — retrying in ${SLEEP_SECONDS}s\"\n  sleep \"$SLEEP_SECONDS\"\ndone\n\necho \"Health check failed after $((MAX_ATTEMPTS * SLEEP_SECONDS))s\"\nexit 1\n```\n\n## Rollback Strategies\n\n### Automated Rollback in Pipeline\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 --timeout=5m\n\n    - name: Post-deployment health check\n      id: health\n      run: .\u002Fscripts\u002Fverify-deployment.sh https:\u002F\u002Fapp.example.com\n\n    - name: Rollback on failure\n      if: failure()\n      run: |\n        kubectl rollout undo deployment\u002Fmy-app\n        echo \"Rolled back to previous revision\"\n```\n\n### Manual Rollback Commands\n\n```bash\n# List revision history with change-cause annotations\nkubectl rollout history deployment\u002Fmy-app\n\n# Rollback to previous version\nkubectl rollout undo deployment\u002Fmy-app\n\n# Rollback to a specific revision\nkubectl rollout undo deployment\u002Fmy-app --to-revision=3\n\n# Verify rollback completed\nkubectl rollout status deployment\u002Fmy-app\n```\n\nFor advanced rollback strategies including database migration rollbacks and Argo Rollouts abort flows, see [`references\u002Fadvanced-strategies.md`](references\u002Fadvanced-strategies.md).\n\n## Monitoring and Metrics\n\n### Key DORA Metrics to Track\n\n| Metric                    | Target (Elite) | How to Measure                           |\n|--------------------------|----------------|------------------------------------------|\n| Deployment Frequency      | Multiple\u002Fday   | Pipeline run count per day               |\n| Lead Time for Changes     | \u003C 1 hour       | Commit timestamp → production deploy     |\n| Change Failure Rate       | \u003C 5%           | Failed deploys \u002F total deploys           |\n| Mean Time to Recovery     | \u003C 1 hour       | Incident open → service restored         |\n\n### Post-Deployment Metric Verification\n\n```yaml\n- name: Verify error rate post-deployment\n  run: |\n    sleep 60  # allow metrics to accumulate\n\n    ERROR_RATE=$(curl -sf \"$PROMETHEUS_URL\u002Fapi\u002Fv1\u002Fquery\" \\\n      --data-urlencode 'query=sum(rate(http_requests_total{status=~\"5..\"}[5m])) \u002F sum(rate(http_requests_total[5m]))' \\\n      | jq '.data.result[0].value[1]')\n\n    echo \"Current error rate: $ERROR_RATE\"\n    if (( $(echo \"$ERROR_RATE > 0.01\" | bc -l) )); then\n      echo \"Error rate $ERROR_RATE exceeds 1% threshold — triggering rollback\"\n      exit 1\n    fi\n```\n\n## Pipeline Best Practices\n\n1. **Fail fast** — Run quick checks (lint, unit tests) before slow ones (E2E, security scans)\n2. **Parallel execution** — Run independent jobs concurrently to minimize total pipeline time\n3. **Caching** — Cache dependency layers and build artifacts between runs\n4. **Artifact promotion** — Build once, promote the same artifact through all environments\n5. **Environment parity** — Keep staging infrastructure as close to production as possible\n6. **Secrets management** — Use secret stores (Vault, AWS Secrets Manager, GitHub encrypted secrets) — never hardcode\n7. **Deployment windows** — Prefer low-traffic windows; enforce change freeze periods via gate policies\n8. **Idempotent deploys** — Ensure re-running a deploy produces the same result\n9. **Rollback automation** — Trigger rollback automatically on health check or metric threshold failure\n10. **Annotate deployments** — Send deployment markers to monitoring tools (Datadog, Grafana) for correlation\n\n## Troubleshooting\n\n### Health check passes in pipeline but service is unhealthy in production\n\nThe pipeline health check is hitting a shallow `\u002Fping` endpoint that returns 200 even when the database is unreachable. Use a deep readiness check that verifies actual dependencies (see Health Checks section above).\n\n### Canary deployment never promotes to 100%\n\nArgo Rollouts requires a valid `AnalysisTemplate` to auto-promote. If the Prometheus query returns no data (e.g., metric name changed), the analysis stays inconclusive and promotion stalls. Add `inconclusiveLimit` so the rollout fails fast rather than hanging:\n\n```yaml\nspec:\n  metrics:\n  - name: error-rate\n    failureCondition: \"result[0] > 0.05\"\n    inconclusiveLimit: 2   # fail after 2 inconclusive results, not hang indefinitely\n    provider:\n      prometheus:\n        query: |\n          sum(rate(http_requests_total{status=~\"5..\"}[2m]))\n          \u002F sum(rate(http_requests_total[2m]))\n```\n\n### Staging deploy succeeds but production job never starts\n\nCheck that production environment protection rules are configured — a missing reviewer assignment means the approval gate waits indefinitely with no notification. In GitHub Actions, ensure `Required reviewers` is set to an existing user or team in **Settings → Environments → production**.\n\n### Docker layer cache busted on every run causing slow builds\n\nIf `COPY . .` appears before dependency installation, any source file change invalidates the dependency layer. Reorder to copy dependency manifests first:\n\n```dockerfile\n# Good: dependencies cached separately from source code\nCOPY package*.json .\u002F\nRUN npm ci\nCOPY . .\nRUN npm run build\n```\n\n### Rollback leaves database migrations applied to old code\n\nA service rollback without a migration rollback causes schema\u002Fcode mismatch errors. Always make migrations backward-compatible (additive only) for at least one release cycle, and keep undo scripts versioned alongside the migration:\n\n```bash\n# migrations\u002FV20240315__add_nullable_column.sql       (forward)\n# migrations\u002FV20240315__add_nullable_column.undo.sql  (backward)\n```\n\nNever run destructive migrations (DROP COLUMN, ALTER NOT NULL) until the old code version is fully retired from all environments.\n\n## Advanced Topics\n\nFor platform-specific pipeline configurations, multi-region promotion workflows, and advanced Argo Rollouts patterns, see:\n\n- [`references\u002Fadvanced-strategies.md`](references\u002Fadvanced-strategies.md) — Extended YAML examples, platform-specific configs (GitHub Actions, GitLab CI, Azure Pipelines), multi-region canary patterns, and database migration rollback strategies\n\n## Related Skills\n\n- `github-actions-templates` - For GitHub Actions implementation patterns and reusable workflows\n- `gitlab-ci-patterns` - For GitLab CI\u002FCD pipeline implementation\n- `secrets-management` - For secrets handling in CI\u002FCD pipelines\n",{"name":5,"description":7},"main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-Agent-智能体\u002FYYC3-Agent-智能体-agents\u002Fplugins\u002Fcicd-automation\u002Fskills\u002Fdeployment-pipeline-design",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill deployment-pipeline-design",{"tool":39,"command":40},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill deployment-pipeline-design",{"tool":42,"command":43},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill deployment-pipeline-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Agent-智能体\u002FYYC3-Agent-智能体-agents\u002Fplugins\u002Fcicd-automation\u002Fskills\u002Fdeployment-pipeline-design\u002FSKILL.md",true,[47],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fadvanced-strategies.md","REFERENCE","参考文档",15950,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Agent-智能体\u002FYYC3-Agent-智能体-agents\u002Fplugins\u002Fcicd-automation\u002Fskills\u002Fdeployment-pipeline-design\u002Freferences\u002Fadvanced-strategies.md",[54,61,68,75,82,89],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]