Staging pipelines and releases
1) Why do you need staging-pipeline
Staging pipeline is a standardized artifact path from PR to production with quality and safety checks "by default." Objectives:- assembly and release reproducibility;
- fast and predictable feedback;
- risk minimization (progressive rolling, phicheflags, rollbacks);
- compliance and change control.
2) Reference supply flow (high-level)
1. PR → automatic checks (lint, unit, SAST, licenses).
2. Build → deterministic image/package, signature and SBOM.
3. Test on Ephemeral → preview-environment per-PR.
- image deposition;
- contract-, integration-, e2e-tests;
- DAST/IAST, regressions, loading smoke;
- manual UAT/QA if necessary.
- 5. Release Candidate (RC) → freeze window → Prod (canary/blue-green).
- 6. Post-deploy checks and auto-post to SLO/error budget.
- 7. Runbook/Changelog → closing release and retrospective.
3) Standardized YAML pipeline template (shutter speed)
yaml
.ci/release.pipeline.yml stages: [verify, build, test, stage, approve, release, post]
verify:
- run: make lint test:unit sbom sast sca build:
- run:
docker build -t registry/app:$GIT_SHA.
cosign sign registry/app:$GIT_SHA oras push registry/sbom:$GIT_SHA sbom.json test:
- run: make test:contract test:integration
- run: make deploy:preview && make test:e2e stage:
- run: make deploy:staging IMAGE=registry/app:$GIT_SHA
- run: make test:e2e:staging && make dast approve:
manual gate: CAB/QA lead
- type: manual required_roles: [release_manager, qa_lead]
release:
- run: make release:canary TRAFFIC=5%
- run: make release:progressive STEPS="5,25,50,100"
post:
- run: make verify:slo && make notify && make create:changelog
4) Gates and readiness criteria (Quality Gates)
Code and security: lints, coverage, SAST/SCA, dependency policy, no critical/high.
Contracts: compatibility of schemes (API/events), Pact/Buf checks.
Tests: unit/integration/e2e p-threshold, stability (flake-rate).
Load smoke: p95/p99 within budget, no degradation.
DAST/IAST: no critical findings, pen test scenarios for sensitive pathways.
Observation: dashboards/alerts "as code" updated, runbooks attached.
CAB/UAT: confirmation in release windows (if required by regulatory/business).
5) Release strategies
Canary - a gradual increase in the share of traffic (5% → 25% → 50% → 100%), automatic roll-forward/rollback for SLO and anomalies.
Blue-Green - parallel media; instant switch, simple rollback.
Feature Flags - logical inclusion of features without redeploy; "dark launch" and A/B capability.
Shadow/Traffic Mirroring - passive traffic run to the new version without affecting users.
Ring Deployments - Waves by Region/Tenant.
6) Rollbacks and release security policy
Auto-rollback by triggers: error-rate growth, p95/TTFB above the threshold, 5xx/timeout growth, DLQ spike.
Manual rollback: command '/rollback <service> <sha> 'in chatbot, one button in release console.
Freeze windows: release to critical events (tournaments/peak matches) is prohibited.
Changelog & Release Notes: generation from PR, SemVer tags, components, migrations.
7) Database migrations and compatibility
Expand → Migrate → Contract:1. Add compatible fields/indexes
2. Application deployment (reads/writes to both schemes);
3. data migration with background jobs;
4. delete old.
Schemes are versioned, idempotent migrations, dry-run in staging.
Protect destructive SQL: require flag/approval, automatic backups and plan-check.
8) Ficheflags and progressive activation
Separate ops flags (for safe operation) and product flags.
Inclusion by audience: percentage, geo, tenant, role.
Flag metrics: conversion impact, latency, errors.
In case of problems - convolution of the flag is faster than rollback.
9) Observability as part of the release
Traces: end-to-end 'trace _ id' from gateway to DB/queues; comparison of old/new versions.
Metrics: p50/p95/p99, error-rate, RPS, saturation, DLQ, retray, Time-to-Wallet/Business KPI.
Logs: structured, PII masking, 'request _ id' correlation.
Alerts: SLO budget, on-call urgent pages, release auto-convolution.
10) Supply chain security
SBOM for each build, storage and binding to the release tag.
Image signatures (cosign), verification on a cluster (policy admission).
SLSA attestation: provable artifact origin.
Policy-as-Code (OPA/Conftest): deny-by-default for infrastructure PRs.
Secrets: KMS only, short-lived tokens, pipeline rotations.
11) Change control and processes
RFC → CRQ → CAB: we agree on the documented change of behavior/contracts in advance.
Release Calendar: Visible windows by product/region/team.
Runbooks: for each component - procedures for enabling/rolling back/diagnostics.
Postmortem/Retro: after significant releases - analysis and action.
12) Staging test profiles
API/Events-Blocks incompatible changes.
Integration/e2e: end-to-end scenarios "deposit," "KYC," "withdrawal."
Load smoke: representative peaks; we monitor resource limits.
Chaos scenarios: provider disconnection, increase in latency, network flappings.
Synthetic monitoring: "trial" transactions on a schedule.
13) Makefile example of release targets (snippet)
makefile release: verify build test stage approve prod post verify:
@make lint test:unit sbom sast sca build:
docker build -t $(IMG).
cosign sign $(IMG)
test:
@make test:contract test:integration deploy:preview test:e2e stage:
kubectl apply -k deploy/staging approve:
@echo "Waiting for QA/CAB approval..."
prod:
make release:canary TRAFFIC="5 25 50 100"
post:
@make verify:slo notify changelog
14) Roles and responsibilities
Dev/Team: code quality, tests, migrations, runbooks.
QA: UAT/regression scenarios, quality control on gates.
SRE/Platform: pipeline reliability, observability, policies.
Release Manager: calendar, windows, CAB, final solution.
Security: SAST/DAST/SCA, supply-chain, secret policy.
15) Release maturity model
1. Basic - manual checks, rare releases, rollbacks are difficult.
2. Advanced - standardized CI/CD, staging contour, canary/blue-green, frequent releases.
3. Expert - progressive delivery by tenants/regions, feature flags-first, policy-as-code, SLO auto-upload, full traceability and SLSA.
16) Implementation Roadmap
M0-M1 (MVP): pipeline template, build + sign + SBOM, staging-deploy, basic tests and gates.
M2-M3: canary/blue-green, preview per-PR, contract tests, DAST, synthetic checks.
M4-M6: feature flags platform, shadow traffic, policy-as-code, auto-rollback, release calendar + CAB-workflow.
M6 +: ring-deployments by region, SLSA certification and strict admission, full automation of runbooks.
17) Pre-Release Checklist
- Image signed, SBOM loaded and release bound.
- Contracts are compatible, tests are green, e2e passed on staging.
- Migrations checked (dry-run), backup ready, rollback plan described.
- Dashboards/alerts have been updated, SLO gates are active.
- Runbook and Changelog published, release windows agreed.
- Feature flags are configured for progressive activation.
- Freeze restrictions are met, on-call is ready.
Brief conclusion
A well-designed staging pipeline turns releases into a manageable routine: uniform templates, clear quality gates, a secure supply chain, progressive rolling and observability reduce risk and reduce the time for changes to production, while maintaining control over quality and business metrics.