Release Engineering
1 - Principes
1.1 Objectifs
release_engineering_goals:
velocity:
- Deploy frequently
- Reduce batch size
- Shorten feedback loop
safety:
- Minimize risk
- Easy rollbacks
- Controlled blast radius
consistency:
- Reproducible builds
- Automated pipelines
- Standardized processes
1.2 Release Philosophy
2 - Deployment Strategies
2.1 Comparatif
| Strategy | Risk | Rollback | Complexity |
|---|---|---|---|
| Big Bang | High | Hard | Low |
| Rolling | Medium | Medium | Medium |
| Blue-Green | Low | Easy | Medium |
| Canary | Very Low | Easy | High |
| Feature Flags | Very Low | Instant | High |
2.2 Rolling Deployment
# Kubernetes Rolling Update
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2 # +2 pods max
maxUnavailable: 1 # -1 pod max
2.3 Blue-Green Deployment
# Switch via Kubernetes Service
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app: api
version: green # Switch from blue to green
2.4 Canary Deployment
# Argo Rollouts Canary
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: api
spec:
replicas: 10
strategy:
canary:
steps:
- setWeight: 10
- pause: { duration: 5m }
- setWeight: 25
- pause: { duration: 10m }
- setWeight: 50
- pause: { duration: 10m }
- setWeight: 100
canaryService: api-canary
stableService: api-stable
3 - Feature Flags
3.1 Types
feature_flag_types:
release_toggle:
description: "Enable feature for gradual rollout"
lifetime: "Short-term"
experiment_toggle:
description: "A/B testing"
lifetime: "Medium-term"
ops_toggle:
description: "Circuit breaker, kill switch"
lifetime: "Permanent"
permission_toggle:
description: "Feature gating by user"
lifetime: "Long-term"
3.2 Implementation
// Feature flag SDK
import { FeatureFlags } from '@company/feature-flags';
const flags = new FeatureFlags({
apiKey: process.env.FF_API_KEY,
environment: process.env.NODE_ENV,
});
// Usage
app.get('/api/checkout', async (req, res) => {
const user = req.user;
if (await flags.isEnabled('new-checkout', user)) {
// New checkout flow
return newCheckout(req, res);
}
// Old checkout flow
return oldCheckout(req, res);
});
3.3 Gradual Rollout
feature_rollout:
feature: new-checkout
stages:
- name: internal
percentage: 0
users: ["@company.com"]
- name: beta
percentage: 5
criteria: "beta_users = true"
- name: early_adopters
percentage: 25
- name: general_availability
percentage: 100
4 - Rollback Strategies
4.1 Types de rollback
rollback_types:
version_rollback:
method: "Deploy previous version"
time: "Minutes"
use_case: "Code bugs"
config_rollback:
method: "Revert configuration"
time: "Seconds"
use_case: "Config errors"
feature_flag:
method: "Disable flag"
time: "Instant"
use_case: "Feature issues"
traffic_shift:
method: "Shift traffic to stable"
time: "Seconds"
use_case: "Canary issues"
4.2 Automatic Rollback
# Argo Rollouts with auto-rollback
apiVersion: argoproj.io/v1alpha1
kind: Rollout
spec:
strategy:
canary:
analysis:
templates:
- templateName: success-rate
args:
- name: service-name
value: api
steps:
- setWeight: 10
- pause: { duration: 5m }
- analysis:
templates:
- templateName: success-rate
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: success-rate
spec:
metrics:
- name: success-rate
interval: 1m
successCondition: result[0] > 0.95
provider:
prometheus:
address: http://prometheus:9090
query: |
sum(rate(http_requests_total{status=~"2.."}[5m]))
/
sum(rate(http_requests_total[5m]))
4.3 Rollback Checklist
rollback_checklist:
before:
- [ ] Confirm rollback is needed
- [ ] Notify stakeholders
- [ ] Check rollback target version
during:
- [ ] Execute rollback
- [ ] Monitor metrics
- [ ] Verify user impact
after:
- [ ] Confirm rollback success
- [ ] Update status page
- [ ] Schedule post-mortem
- [ ] Track root cause
5 - Progressive Delivery
5.1 Pipeline
5.2 Automated Promotion
progressive_delivery:
stages:
staging:
auto_promote: true
conditions:
- tests_pass
- no_critical_vulnerabilities
canary:
percentage: 5
duration: 30m
auto_promote: true
conditions:
- error_rate < 1%
- latency_p99 < 200ms
expand:
percentage: 25
duration: 1h
auto_promote: true
conditions:
- error_rate < 0.5%
- latency_p99 < 200ms
- no_increase_in_errors
production:
percentage: 100
manual_approval: false
6 - Release Documentation
6.1 Changelog
# Changelog
## [2.5.0] - 2024-01-15
### Added
- New checkout flow with Apple Pay support
- Real-time inventory tracking
### Changed
- Improved cart performance (30% faster)
- Updated payment SDK to v3.2
### Fixed
- Fixed currency conversion bug (#1234)
- Resolved timeout issues on mobile
### Security
- Updated dependencies for CVE-2024-1234
### Deprecated
- Legacy checkout API (removal in v3.0)
6.2 Release Notes
release_notes:
version: "2.5.0"
date: "2024-01-15"
highlights:
- "Apple Pay support"
- "30% faster cart"
user_impact:
- "Customers can now use Apple Pay"
- "Faster shopping experience"
technical_changes:
- "New payment integration"
- "Cart caching improvements"
known_issues:
- "Apple Pay not available in some regions"
rollback_instructions:
- "kubectl rollout undo deployment/checkout"
Résumé
Dans ce chapitre, nous avons appris :
- Les principes Release Engineering
- Les stratégies de déploiement
- Les Feature Flags
- Les stratégies de Rollback
- La Progressive Delivery
- La documentation des releases
Prochaine étape
Dans le prochain chapitre, nous verrons les Bonnes pratiques SRE.
→ Chapitre suivant : Bonnes pratiques