AgentSkillsCN

deployment

制定并执行安全部署方案,包括回滚流程、验证机制与监控措施

SKILL.md
--- frontmatter
name: deployment
description: Plan and execute safe deployments with rollback procedures, verification, and monitoring

Deployment

Plan and execute safe deployments — rollback procedures, verification steps, and monitoring.

When to Use

  • Preparing a production deployment
  • Setting up deployment pipelines
  • Defining rollback procedures
  • Verifying a deployment post-release

Workflow

1. Pre-Deployment Checklist

Before deploying:

  • All tests pass in CI
  • Staging deployment verified
  • Rollback procedure documented
  • Monitoring alerts configured
  • Not deploying on Friday afternoon

2. Choose a Deployment Strategy

StrategyWhenRisk
Blue/GreenNeed instant rollbackLow — traffic switch
CanaryTesting with real trafficLow — limited blast radius
RollingResource-constrained environmentsMedium — gradual exposure
DirectNon-critical services onlyHigh — all-or-nothing

3. Deploy

bash
# Example: Kubernetes blue/green
kubectl apply -f deployment-green.yaml
kubectl rollout status deployment/myapp-green

# Verify health
curl -f https://myapp-green.internal/health/ready

# Cut traffic
kubectl patch service myapp -p '{"spec":{"selector":{"version":"green"}}}'

4. Post-Deployment Verification

  1. Health check/health/ready returns 200
  2. Smoke test — Critical user path works (e.g., login)
  3. Metrics — Error rate and latency within normal range
  4. Logs — No new error patterns in aggregator

5. Rollback (if needed)

TriggerAction
Error rate > 1% for 5 minutesAutomated rollback to N-1
Performance degradation > 50%Manual rollback after investigation
Security vulnerability foundEmergency rollback immediately
bash
# Blue/Green rollback — switch selector back
kubectl patch service myapp -p '{"spec":{"selector":{"version":"blue"}}}'

6. Post-Deploy

  • Confirm metrics stable for 30 minutes
  • Update deployment log/changelog
  • Communicate to team

Red Flags

SignalAction
Friday afternoon deployPostpone to Monday
No rollback planDefine triggers and procedure first
Skipping stagingRun in staging first
100% traffic on first deployUse canary or blue/green

Related Skills

SkillWhen
e2e-testingSmoke testing after deploy
secure-codingSecurity review before release
loggingVerifying logs post-deploy

Backing Guide