[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F8JGCJGFZ7CANBBEB8757K":3,"skill-same:01M7F8JGCJGFZ7CANBBEB8757K":52},{"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":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7F8JGCJGFZ7CANBBEB8757K","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.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdeployment-pipeline-design\u002FSKILL.md",[],[],"2026-11-16 10:05:34",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","d69096e239f2a89aabc2cd078c47664a9d3b1e11","06-前端与设计\u002Fdeployment-pipeline-design",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill deployment-pipeline-design",{"tool":38,"command":39},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill deployment-pipeline-design",{"tool":41,"command":42},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill deployment-pipeline-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdeployment-pipeline-design\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fadvanced-strategies.md","REFERENCE","参考文档",15950,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdeployment-pipeline-design\u002Freferences\u002Fadvanced-strategies.md",[53,60,65,72,79,86],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":61,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]