env-promotion
Design env-promotion (dev → staging → prod) — one artifact promoted, env-specific config injected, gates between stages, rollback path.
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- env-promotion
- description
- Design env-promotion (dev → staging → prod) — one artifact promoted, env-specific config injected, gates between stages, rollback path.
03 SKILL.md 正文
env-promotion
Promote the same artifact through environments rather than rebuilding per env. Pin the gates between stages.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
When to use
- A team is moving from "build per env" to "build once, promote".
- Releases keep regressing because dev/staging differ from prod in ways that aren't tracked.
- A workflow needs a deploy path before opening prod traffic.
Inputs
- The environments in order (e.g. dev → staging → prod) and how each is deployed today (required).
- The artifact type (container image, package, bundle) and where it is stored (registry/repository).
- The gates the team already has, and who may approve a prod promotion (optional; absent → propose them, marked
[VERIFY: approver]). - Promotions are side effects: the design shows the exact promote commands; nothing is promoted or deployed without the operator's go-ahead.
Procedure
- One artifact, many envs. The same container image / package goes through every stage. Config differs; the binary does not. Promote by immutable digest (
image@sha256:…), not by tag — a tag can be re-pointed between stages. - Three default stages:
- dev — fast feedback. Auto-deploy on merge to main.
- staging — production-shaped. Production traffic shape (or shadow), production-grade data (sanitized).
- prod — canary first, then full.
- Gate per transition:
- dev → staging: tests + smoke against deployed dev.
- staging → prod: error budget healthy, change freeze respected, on-call ack, change record opened (no PII in record).
- prod canary → prod full: SLO burn rate stays below threshold for canary window; automatic abort otherwise.
- Config injection:
- Per-env config in a single source of truth (a YAML per env in the repo, or a parameter store).
- No secrets in repo. Secrets injected from a secret manager via env-specific names.
- Rollback path named per stage. Usually "redeploy the previous version's image digest". Faster than git revert — and only possible if database migrations are backward-compatible across adjacent versions (expand/contract:
polymath-backend:migration-plan); a migration the previous version can't run against is a rollback blocker, so call it out per release. - Observability per stage — same dashboard template, dashboard filterable by env. Alerts route differently per env.
Output
Env promotion: refund-service
Artifact: container image `refund:${git_sha}` pushed once from main;
promoted by digest (refund@sha256:…), never re-tagged per env.
Stages:
dev → auto-deploy on merge to main
gate: nothing (fast feedback)
staging → auto-deploy when dev has been running ≥ 10m with no error
gate: integration suite pass, traffic-replay smoke pass
prod → manual trigger from staging
gate (canary): 10% traffic for 30m;
abort if burn rate > 14× over 1h window
gate (full): error rate within 1% of canary baseline
for 30m; manual ack required
Config:
envs/dev.yaml, envs/staging.yaml, envs/prod.yaml in repo.
Secrets injected at deploy time from AWS Secrets Manager by name.
Rollback:
deploy prior image tag (we keep last 10). Documented at runbook X.
Observability:
Single Grafana dashboard with `env` filter. Alerts: dev → silenced,
staging → #staging-alerts, prod → PagerDuty.
Anti-patterns to avoid
- Building per env. The binary changes, so the test signal is meaningless.
- Manual
kubectl applyto prod with the local config that "shouldn't differ". - Gates that everyone manually skips. If a gate doesn't fire, remove it.
- No rollback path documented.
04 同仓库更多 Skills
runbook
Write or refresh an operational runbook for an alert/symptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.
rfc
Draft a lightweight design RFC to docs/rfcs/<slug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).
editorial-pass
Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.
architecture-review-facilitation
Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.
architecture-doc
Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).
adr
Write an Architecture Decision Record (Michael Nygard format) to docs/adrs/NNNN-<slug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).