swe-workflow-skills 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/VERSION +1 -0
- package/bin/cli.mjs +44 -0
- package/catalog.json +225 -0
- package/commands/role.md +34 -0
- package/hooks/session-start.mjs +118 -0
- package/install.mjs +318 -0
- package/package.json +47 -0
- package/roles.json +194 -0
- package/scripts/resolve.mjs +296 -0
- package/skills/accessibility-design/SKILL.md +128 -0
- package/skills/accessibility-design/evals/evals.json +51 -0
- package/skills/accessibility-design/references/accessibility-patterns.md +321 -0
- package/skills/api-design/SKILL.md +144 -0
- package/skills/api-design/evals/evals.json +48 -0
- package/skills/api-design/references/rest-conventions.md +147 -0
- package/skills/api-design/templates/api-spec.md +156 -0
- package/skills/architecture-design/SKILL.md +86 -0
- package/skills/architecture-design/evals/evals.json +44 -0
- package/skills/architecture-design/references/clean-architecture.md +147 -0
- package/skills/architecture-design/references/component-principles.md +129 -0
- package/skills/architecture-design/references/principles.md +81 -0
- package/skills/architecture-design/references/solid-principles.md +106 -0
- package/skills/architecture-design/templates/adr.md +63 -0
- package/skills/architecture-documentation/SKILL.md +126 -0
- package/skills/architecture-documentation/evals/evals.json +44 -0
- package/skills/architecture-documentation/references/abstraction-levels.md +91 -0
- package/skills/architecture-documentation/references/diagram-tooling.md +141 -0
- package/skills/architecture-documentation/templates/architecture-doc.md +171 -0
- package/skills/bug-investigating/SKILL.md +133 -0
- package/skills/bug-investigating/evals/evals.json +56 -0
- package/skills/bug-investigating/references/common-bugs.md +62 -0
- package/skills/bug-investigating/references/debugging-patterns.md +94 -0
- package/skills/cicd-pipeline/SKILL.md +87 -0
- package/skills/cicd-pipeline/evals/evals.json +34 -0
- package/skills/cicd-pipeline/references/pipeline-patterns.md +206 -0
- package/skills/cicd-pipeline/templates/github-actions.md +206 -0
- package/skills/code-reviewing/SKILL.md +92 -0
- package/skills/code-reviewing/evals/evals.json +62 -0
- package/skills/code-reviewing/references/error-handling.md +108 -0
- package/skills/code-reviewing/references/review-checklist.md +144 -0
- package/skills/configuration-strategy/SKILL.md +109 -0
- package/skills/configuration-strategy/evals/evals.json +41 -0
- package/skills/configuration-strategy/references/config-patterns.md +161 -0
- package/skills/containerization/SKILL.md +90 -0
- package/skills/containerization/evals/evals.json +36 -0
- package/skills/containerization/references/dockerfile-patterns.md +168 -0
- package/skills/containerization/templates/dockerfile.md +154 -0
- package/skills/data-modeling/SKILL.md +83 -0
- package/skills/data-modeling/evals/evals.json +43 -0
- package/skills/data-modeling/references/conventions.md +57 -0
- package/skills/data-modeling/templates/schema.md +120 -0
- package/skills/dependency-impact-analysis/SKILL.md +113 -0
- package/skills/dependency-impact-analysis/evals/evals.json +41 -0
- package/skills/dependency-impact-analysis/references/impact-patterns.md +150 -0
- package/skills/dependency-management/SKILL.md +161 -0
- package/skills/dependency-management/evals/evals.json +48 -0
- package/skills/dependency-management/references/evaluation-checklist.md +127 -0
- package/skills/deployment-checklist/SKILL.md +132 -0
- package/skills/deployment-checklist/evals/evals.json +58 -0
- package/skills/deployment-checklist/references/pre-deploy-gates.md +91 -0
- package/skills/deployment-repo/SKILL.md +190 -0
- package/skills/deployment-repo/evals/evals.json +44 -0
- package/skills/deployment-repo/references/deployment-repo-patterns.md +258 -0
- package/skills/deployment-repo/references/version-compatibility.md +227 -0
- package/skills/deployment-repo/templates/deployment-repo-structure.md +226 -0
- package/skills/effort-estimation/SKILL.md +95 -0
- package/skills/effort-estimation/evals/evals.json +32 -0
- package/skills/effort-estimation/references/estimation-methods.md +154 -0
- package/skills/feature-planning/SKILL.md +84 -0
- package/skills/feature-planning/evals/evals.json +44 -0
- package/skills/feature-planning/templates/plan.md +55 -0
- package/skills/feature-planning/templates/task.md +26 -0
- package/skills/frontend-architecture/SKILL.md +154 -0
- package/skills/frontend-architecture/evals/evals.json +34 -0
- package/skills/frontend-architecture/references/component-patterns.md +264 -0
- package/skills/frontend-architecture/templates/folder-structure.md +203 -0
- package/skills/git-workflow/SKILL.md +127 -0
- package/skills/git-workflow/evals/evals.json +44 -0
- package/skills/git-workflow/references/conventions.md +142 -0
- package/skills/git-workflow/templates/pull-request.md +57 -0
- package/skills/gitops-delivery/SKILL.md +319 -0
- package/skills/gitops-delivery/evals/evals.json +44 -0
- package/skills/gitops-delivery/references/gitops-patterns.md +478 -0
- package/skills/gitops-delivery/templates/gitops-config.md +196 -0
- package/skills/incident-response/SKILL.md +130 -0
- package/skills/incident-response/evals/evals.json +55 -0
- package/skills/incident-response/references/communication-templates.md +134 -0
- package/skills/incident-response/references/severity-levels.md +77 -0
- package/skills/incident-response/templates/incident-timeline.md +57 -0
- package/skills/infrastructure-as-code/SKILL.md +86 -0
- package/skills/infrastructure-as-code/evals/evals.json +33 -0
- package/skills/infrastructure-as-code/references/iac-patterns.md +179 -0
- package/skills/infrastructure-as-code/templates/terraform-module.md +158 -0
- package/skills/metrics-and-okrs/SKILL.md +113 -0
- package/skills/metrics-and-okrs/evals/evals.json +33 -0
- package/skills/metrics-and-okrs/references/metric-catalog.md +90 -0
- package/skills/metrics-and-okrs/templates/okr-document.md +61 -0
- package/skills/ml-experiment-tracking/SKILL.md +96 -0
- package/skills/ml-experiment-tracking/evals/evals.json +32 -0
- package/skills/ml-experiment-tracking/references/tracking-tools.md +127 -0
- package/skills/ml-model-deployment/SKILL.md +106 -0
- package/skills/ml-model-deployment/evals/evals.json +34 -0
- package/skills/ml-model-deployment/references/serving-patterns.md +162 -0
- package/skills/ml-pipeline-design/SKILL.md +162 -0
- package/skills/ml-pipeline-design/evals/evals.json +34 -0
- package/skills/ml-pipeline-design/references/pipeline-components.md +174 -0
- package/skills/observability-design/SKILL.md +162 -0
- package/skills/observability-design/evals/evals.json +52 -0
- package/skills/observability-design/references/logging-patterns.md +229 -0
- package/skills/observability-design/references/slo-framework.md +151 -0
- package/skills/observability-design/templates/slo-document.md +80 -0
- package/skills/performance-optimization/SKILL.md +83 -0
- package/skills/performance-optimization/evals/evals.json +47 -0
- package/skills/performance-optimization/references/bottleneck-patterns.md +256 -0
- package/skills/performance-optimization/references/concurrency.md +101 -0
- package/skills/prd-writing/SKILL.md +109 -0
- package/skills/prd-writing/evals/evals.json +33 -0
- package/skills/prd-writing/references/prd-examples.md +132 -0
- package/skills/prd-writing/templates/prd.md +71 -0
- package/skills/prd-writing/templates/rfc.md +79 -0
- package/skills/project-documentation/SKILL.md +104 -0
- package/skills/project-documentation/evals/evals.json +48 -0
- package/skills/project-documentation/references/contributing-guide.md +100 -0
- package/skills/project-documentation/templates/changelog.md +59 -0
- package/skills/project-documentation/templates/readme.md +121 -0
- package/skills/project-proposal/SKILL.md +90 -0
- package/skills/project-proposal/evals/evals.json +31 -0
- package/skills/project-proposal/references/proposal-examples.md +140 -0
- package/skills/project-proposal/templates/proposal.md +76 -0
- package/skills/project-review/SKILL.md +111 -0
- package/skills/project-review/evals/evals.json +42 -0
- package/skills/refactoring/SKILL.md +90 -0
- package/skills/refactoring/evals/evals.json +44 -0
- package/skills/refactoring/references/transformations.md +132 -0
- package/skills/retrospective/SKILL.md +157 -0
- package/skills/retrospective/evals/evals.json +34 -0
- package/skills/retrospective/references/facilitation-guide.md +130 -0
- package/skills/retrospective/templates/post-mortem.md +121 -0
- package/skills/rollback-strategy/SKILL.md +116 -0
- package/skills/rollback-strategy/evals/evals.json +55 -0
- package/skills/rollback-strategy/references/rollback-patterns.md +125 -0
- package/skills/rollback-strategy/templates/rollback-plan.md +69 -0
- package/skills/security-audit/SKILL.md +146 -0
- package/skills/security-audit/evals/evals.json +66 -0
- package/skills/security-audit/references/owasp-top-10.md +167 -0
- package/skills/security-audit/templates/security-report.md +79 -0
- package/skills/skill-router/SKILL.md +171 -0
- package/skills/skill-router/evals/evals.json +39 -0
- package/skills/strategic-review/SKILL.md +106 -0
- package/skills/strategic-review/evals/evals.json +42 -0
- package/skills/strategic-review/templates/full-review-prompt.md +84 -0
- package/skills/tdd-workflow/SKILL.md +147 -0
- package/skills/tdd-workflow/evals/evals.json +58 -0
- package/skills/tdd-workflow/references/test-quality.md +71 -0
- package/skills/technical-debt-review/SKILL.md +113 -0
- package/skills/technical-debt-review/evals/evals.json +41 -0
- package/skills/technical-debt-review/references/debt-taxonomy.md +124 -0
- package/skills/technical-debt-review/templates/debt-audit.md +85 -0
- package/skills/test-data-strategy/SKILL.md +129 -0
- package/skills/test-data-strategy/evals/evals.json +49 -0
- package/skills/test-data-strategy/references/data-generation-patterns.md +341 -0
- package/skills/test-suite-design/SKILL.md +137 -0
- package/skills/test-suite-design/evals/evals.json +69 -0
- package/skills/test-suite-design/references/test-infrastructure.md +175 -0
- package/skills/test-suite-design/references/testing-pyramid.md +140 -0
- package/skills/ui-ux-design/SKILL.md +117 -0
- package/skills/ui-ux-design/evals/evals.json +35 -0
- package/skills/ui-ux-design/references/interaction-patterns.md +145 -0
- package/skills/ui-ux-design/templates/screen-spec.md +97 -0
- package/skills/verification-before-completion/SKILL.md +85 -0
- package/skills/verification-before-completion/evals/evals.json +53 -0
- package/skills/writing-skills/SKILL.md +87 -0
- package/skills/writing-skills/evals/evals.json +41 -0
- package/skills/writing-skills/references/pressure-testing.md +69 -0
- package/uninstall.mjs +182 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Deployment Repo Patterns by Scale Tier
|
|
2
|
+
|
|
3
|
+
## Lightweight Tier (1 team, 2-5 services)
|
|
4
|
+
|
|
5
|
+
Best for small teams that need coordinated local dev and basic version tracking without Kubernetes complexity.
|
|
6
|
+
|
|
7
|
+
### Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
deployment-repo/
|
|
11
|
+
├── docker-compose.yml # Full system for local dev
|
|
12
|
+
├── docker-compose.override.yml # Developer-specific overrides (gitignored)
|
|
13
|
+
├── .versions.env # Pinned service versions
|
|
14
|
+
├── .env.example # Environment template (copy to .env)
|
|
15
|
+
├── Makefile # Developer commands
|
|
16
|
+
├── tests/
|
|
17
|
+
│ └── e2e/
|
|
18
|
+
│ ├── package.json # E2E test dependencies
|
|
19
|
+
│ └── specs/ # E2E test files
|
|
20
|
+
├── docs/
|
|
21
|
+
│ ├── architecture.md # System overview
|
|
22
|
+
│ └── local-setup.md # Getting started guide
|
|
23
|
+
└── scripts/
|
|
24
|
+
├── setup.sh # First-time setup (clone repos, build images)
|
|
25
|
+
├── seed.sh # Seed dev database
|
|
26
|
+
└── health-check.sh # Verify all services are running
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Example docker-compose.yml
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
services:
|
|
33
|
+
api:
|
|
34
|
+
image: ${REGISTRY}/api:${API_VERSION}
|
|
35
|
+
build:
|
|
36
|
+
context: ../api-repo # For local dev with source
|
|
37
|
+
dockerfile: Dockerfile
|
|
38
|
+
ports:
|
|
39
|
+
- "8000:8000"
|
|
40
|
+
environment:
|
|
41
|
+
DATABASE_URL: postgres://user:pass@db:5432/app
|
|
42
|
+
REDIS_URL: redis://cache:6379
|
|
43
|
+
depends_on:
|
|
44
|
+
db:
|
|
45
|
+
condition: service_healthy
|
|
46
|
+
cache:
|
|
47
|
+
condition: service_healthy
|
|
48
|
+
healthcheck:
|
|
49
|
+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
50
|
+
interval: 10s
|
|
51
|
+
retries: 3
|
|
52
|
+
|
|
53
|
+
frontend:
|
|
54
|
+
image: ${REGISTRY}/frontend:${FRONTEND_VERSION}
|
|
55
|
+
build:
|
|
56
|
+
context: ../frontend-repo
|
|
57
|
+
dockerfile: Dockerfile
|
|
58
|
+
ports:
|
|
59
|
+
- "3000:3000"
|
|
60
|
+
environment:
|
|
61
|
+
API_URL: http://api:8000
|
|
62
|
+
depends_on:
|
|
63
|
+
api:
|
|
64
|
+
condition: service_healthy
|
|
65
|
+
|
|
66
|
+
db:
|
|
67
|
+
image: postgres:16-alpine
|
|
68
|
+
volumes:
|
|
69
|
+
- pgdata:/var/lib/postgresql/data
|
|
70
|
+
- ./scripts/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
71
|
+
environment:
|
|
72
|
+
POSTGRES_USER: user
|
|
73
|
+
POSTGRES_PASSWORD: pass
|
|
74
|
+
POSTGRES_DB: app
|
|
75
|
+
healthcheck:
|
|
76
|
+
test: ["CMD-SHELL", "pg_isready -U user"]
|
|
77
|
+
interval: 5s
|
|
78
|
+
retries: 5
|
|
79
|
+
|
|
80
|
+
cache:
|
|
81
|
+
image: redis:7-alpine
|
|
82
|
+
healthcheck:
|
|
83
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
84
|
+
interval: 5s
|
|
85
|
+
retries: 3
|
|
86
|
+
|
|
87
|
+
volumes:
|
|
88
|
+
pgdata:
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Example Makefile
|
|
92
|
+
|
|
93
|
+
```makefile
|
|
94
|
+
.PHONY: up down test logs setup
|
|
95
|
+
|
|
96
|
+
up: ## Start all services
|
|
97
|
+
docker compose up -d
|
|
98
|
+
|
|
99
|
+
down: ## Stop all services
|
|
100
|
+
docker compose down
|
|
101
|
+
|
|
102
|
+
test: ## Run E2E tests
|
|
103
|
+
docker compose up -d
|
|
104
|
+
cd tests/e2e && npm test
|
|
105
|
+
|
|
106
|
+
logs: ## Tail all service logs
|
|
107
|
+
docker compose logs -f
|
|
108
|
+
|
|
109
|
+
setup: ## First-time setup
|
|
110
|
+
cp .env.example .env
|
|
111
|
+
docker compose build
|
|
112
|
+
docker compose up -d
|
|
113
|
+
./scripts/seed.sh
|
|
114
|
+
|
|
115
|
+
bump-%: ## Bump a service version: make bump-api VERSION=v1.2.3
|
|
116
|
+
sed -i 's/^$*_VERSION=.*/$*_VERSION=$(VERSION)/' .versions.env
|
|
117
|
+
@echo "Updated $* to $(VERSION). Run 'make test' to validate."
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Example .versions.env
|
|
121
|
+
|
|
122
|
+
```env
|
|
123
|
+
API_VERSION=v1.3.2
|
|
124
|
+
FRONTEND_VERSION=v2.1.0
|
|
125
|
+
REGISTRY=ghcr.io/myorg
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Standard Tier (2-3 teams, 5-15 services)
|
|
129
|
+
|
|
130
|
+
Adds Helm/Kustomize for multi-environment K8s deployments, structured CI, and contract testing.
|
|
131
|
+
|
|
132
|
+
### Structure
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
deployment-repo/
|
|
136
|
+
├── versions.yaml # System-wide version pins
|
|
137
|
+
├── docker-compose.yml # Local dev orchestration
|
|
138
|
+
├── Makefile
|
|
139
|
+
├── helm/
|
|
140
|
+
│ ├── Chart.yaml # Umbrella chart
|
|
141
|
+
│ ├── values.yaml # Shared defaults
|
|
142
|
+
│ └── values/
|
|
143
|
+
│ ├── dev.yaml # Dev overrides
|
|
144
|
+
│ ├── staging.yaml # Staging overrides
|
|
145
|
+
│ └── production.yaml # Production overrides
|
|
146
|
+
├── contracts/
|
|
147
|
+
│ ├── apis/ # OpenAPI specs per service
|
|
148
|
+
│ │ ├── user-service.v1.yaml
|
|
149
|
+
│ │ └── api-gateway.v2.yaml
|
|
150
|
+
│ └── events/ # Event schemas
|
|
151
|
+
│ └── user-created.v1.avsc
|
|
152
|
+
├── tests/
|
|
153
|
+
│ ├── e2e/
|
|
154
|
+
│ └── contract/ # Contract verification tests
|
|
155
|
+
├── ci/
|
|
156
|
+
│ ├── validate-versions.yml # Contract + E2E on version bump PRs
|
|
157
|
+
│ └── promote.yml # Environment promotion pipeline
|
|
158
|
+
├── environments/
|
|
159
|
+
│ ├── dev/
|
|
160
|
+
│ │ └── versions.yaml
|
|
161
|
+
│ ├── staging/
|
|
162
|
+
│ │ └── versions.yaml
|
|
163
|
+
│ └── production/
|
|
164
|
+
│ └── versions.yaml
|
|
165
|
+
├── infrastructure/
|
|
166
|
+
│ └── terraform/ # Shared infra (databases, queues, networking)
|
|
167
|
+
├── docs/
|
|
168
|
+
│ ├── architecture/
|
|
169
|
+
│ │ └── adr/ # Architecture Decision Records
|
|
170
|
+
│ ├── runbooks/
|
|
171
|
+
│ └── onboarding.md
|
|
172
|
+
└── scripts/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Kustomize alternative to Helm
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
deployment-repo/
|
|
179
|
+
├── base/
|
|
180
|
+
│ ├── api-gateway/
|
|
181
|
+
│ │ ├── deployment.yaml
|
|
182
|
+
│ │ ├── service.yaml
|
|
183
|
+
│ │ └── kustomization.yaml
|
|
184
|
+
│ ├── user-service/
|
|
185
|
+
│ └── ...
|
|
186
|
+
├── overlays/
|
|
187
|
+
│ ├── dev/
|
|
188
|
+
│ │ ├── kustomization.yaml # Patches: replicas, resource limits, image tags
|
|
189
|
+
│ │ └── patches/
|
|
190
|
+
│ ├── staging/
|
|
191
|
+
│ └── production/
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Enterprise Tier (many teams, 15+ services)
|
|
195
|
+
|
|
196
|
+
Adds ArgoCD/Flux integration, ApplicationSets, automated promotion, and audit infrastructure.
|
|
197
|
+
|
|
198
|
+
### Structure
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
deployment-repo/
|
|
202
|
+
├── versions.yaml
|
|
203
|
+
├── argocd/ # ArgoCD Application definitions
|
|
204
|
+
│ ├── app-of-apps.yaml # Root Application
|
|
205
|
+
│ ├── dev/
|
|
206
|
+
│ │ └── applications.yaml # Per-service ArgoCD Applications for dev
|
|
207
|
+
│ ├── staging/
|
|
208
|
+
│ └── production/
|
|
209
|
+
├── helm/
|
|
210
|
+
│ ├── charts/ # Per-service Helm charts (or references to external charts)
|
|
211
|
+
│ └── values/ # Per-environment values
|
|
212
|
+
├── contracts/
|
|
213
|
+
├── tests/
|
|
214
|
+
├── ci/
|
|
215
|
+
│ ├── validate-versions.yml
|
|
216
|
+
│ ├── promote.yml
|
|
217
|
+
│ └── drift-report.yml # Detect config drift
|
|
218
|
+
├── environments/
|
|
219
|
+
├── infrastructure/
|
|
220
|
+
├── policies/ # OPA/Gatekeeper policies
|
|
221
|
+
├── docs/
|
|
222
|
+
└── scripts/
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### App of Apps pattern (ArgoCD)
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
# argocd/app-of-apps.yaml
|
|
229
|
+
apiVersion: argoproj.io/v1alpha1
|
|
230
|
+
kind: Application
|
|
231
|
+
metadata:
|
|
232
|
+
name: system-apps
|
|
233
|
+
namespace: argocd
|
|
234
|
+
spec:
|
|
235
|
+
project: default
|
|
236
|
+
source:
|
|
237
|
+
repoURL: https://github.com/org/deployment-repo
|
|
238
|
+
targetRevision: main
|
|
239
|
+
path: argocd/production
|
|
240
|
+
destination:
|
|
241
|
+
server: https://kubernetes.default.svc
|
|
242
|
+
syncPolicy:
|
|
243
|
+
automated:
|
|
244
|
+
prune: true
|
|
245
|
+
selfHeal: true
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Anti-Patterns
|
|
249
|
+
|
|
250
|
+
**Mixing app source with deployment config**: Leads to infinite CI loops (deploy triggers build triggers deploy). Keep them separate.
|
|
251
|
+
|
|
252
|
+
**Using `latest` tags instead of pinned versions**: Destroys reproducibility. You can't answer "what was running in production last Tuesday?"
|
|
253
|
+
|
|
254
|
+
**Per-service deployment repos**: Defeats the purpose. The value is seeing the whole system in one place.
|
|
255
|
+
|
|
256
|
+
**Manual version tracking** (Slack messages, wiki pages): Will drift from reality within days. The deployment repo IS the tracking system.
|
|
257
|
+
|
|
258
|
+
**Promoting services independently without testing the set**: Version A of service X might work with version B of service Y in staging but fail with version C that was deployed separately. Always validate the full version set.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Version Compatibility in Polyrepo Architectures
|
|
2
|
+
|
|
3
|
+
## Semantic Versioning as the Compatibility Contract
|
|
4
|
+
|
|
5
|
+
Each app repo must follow semver strictly — it's the language the deployment repo uses to reason about compatibility:
|
|
6
|
+
|
|
7
|
+
- **MAJOR** (v2.0.0): Breaking changes to the service's external interface (API contracts, event schemas, shared database schemas). Consumers MUST update.
|
|
8
|
+
- **MINOR** (v1.3.0): New functionality, backward-compatible. Consumers MAY update to use new features.
|
|
9
|
+
- **PATCH** (v1.2.4): Bug fixes, no interface changes. Consumers SHOULD update.
|
|
10
|
+
|
|
11
|
+
**What counts as the "external interface":**
|
|
12
|
+
- REST/gRPC API request and response shapes
|
|
13
|
+
- Published event schemas (message payloads)
|
|
14
|
+
- Shared database tables that other services read
|
|
15
|
+
- Configuration contracts (expected environment variables, feature flags)
|
|
16
|
+
- CLI interfaces consumed by other tools
|
|
17
|
+
|
|
18
|
+
**Versioning enforcement in app repos:**
|
|
19
|
+
- Tag releases with `vMAJOR.MINOR.PATCH` in git
|
|
20
|
+
- CI publishes Docker images tagged with the git tag
|
|
21
|
+
- Breaking change detection should be automated where possible (OpenAPI diff, schema registry compatibility checks)
|
|
22
|
+
|
|
23
|
+
## The Compatibility Lock
|
|
24
|
+
|
|
25
|
+
The deployment repo's `versions.yaml` is a compatibility lock — it records version combinations that have been validated together.
|
|
26
|
+
|
|
27
|
+
### Structure
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
# versions.yaml
|
|
31
|
+
services:
|
|
32
|
+
api-gateway:
|
|
33
|
+
image: registry.example.com/api-gateway
|
|
34
|
+
version: v2.3.1
|
|
35
|
+
min_compatible:
|
|
36
|
+
user-service: ">=v1.5.0"
|
|
37
|
+
billing-service: ">=v3.0.0"
|
|
38
|
+
user-service:
|
|
39
|
+
image: registry.example.com/user-service
|
|
40
|
+
version: v1.7.0
|
|
41
|
+
billing-service:
|
|
42
|
+
image: registry.example.com/billing-service
|
|
43
|
+
version: v3.1.2
|
|
44
|
+
notification-service:
|
|
45
|
+
image: registry.example.com/notification-service
|
|
46
|
+
version: v1.0.4
|
|
47
|
+
frontend:
|
|
48
|
+
image: registry.example.com/frontend
|
|
49
|
+
version: v4.2.0
|
|
50
|
+
min_compatible:
|
|
51
|
+
api-gateway: ">=v2.0.0"
|
|
52
|
+
|
|
53
|
+
validated:
|
|
54
|
+
timestamp: "2025-01-15T14:30:00Z"
|
|
55
|
+
contract_tests: pass
|
|
56
|
+
e2e_tests: pass
|
|
57
|
+
validated_by: "ci-pipeline-run-1234"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### How the lock works
|
|
61
|
+
|
|
62
|
+
1. Developer bumps `user-service` to `v1.8.0` in the deployment repo (via PR)
|
|
63
|
+
2. CI reads `versions.yaml`, checks `min_compatible` constraints
|
|
64
|
+
3. CI runs contract tests between all services at their pinned versions
|
|
65
|
+
4. CI runs E2E tests against the composed system
|
|
66
|
+
5. If all pass: PR is mergeable, `validated` block is updated
|
|
67
|
+
6. If any fail: PR is blocked, developer must fix compatibility or coordinate a multi-service bump
|
|
68
|
+
|
|
69
|
+
### Lightweight alternative (small teams)
|
|
70
|
+
|
|
71
|
+
For the lightweight tier, a `.env` file serves the same purpose:
|
|
72
|
+
|
|
73
|
+
```env
|
|
74
|
+
# .versions.env — the compatibility lock (lightweight)
|
|
75
|
+
API_GATEWAY_VERSION=v2.3.1
|
|
76
|
+
USER_SERVICE_VERSION=v1.7.0
|
|
77
|
+
BILLING_SERVICE_VERSION=v3.1.2
|
|
78
|
+
FRONTEND_VERSION=v4.2.0
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Referenced by `docker-compose.yml`:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
services:
|
|
85
|
+
api-gateway:
|
|
86
|
+
image: registry.example.com/api-gateway:${API_GATEWAY_VERSION}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Consumer-Driven Contract Testing
|
|
90
|
+
|
|
91
|
+
Contract tests are the mechanism that makes version pinning trustworthy. Without them, the compatibility lock records what was *assumed* compatible, not what was *verified*.
|
|
92
|
+
|
|
93
|
+
### How Pact-style contracts work
|
|
94
|
+
|
|
95
|
+
1. **Consumer defines expectations**: The frontend team writes a Pact test that says "when I call GET /users/123, I expect a response with `id`, `name`, and `email` fields"
|
|
96
|
+
2. **Contract is published**: The contract is stored in a Pact Broker or the deployment repo's `contracts/` directory
|
|
97
|
+
3. **Provider verifies**: The user-service CI runs the contract against its actual API — does it satisfy the frontend's expectations?
|
|
98
|
+
4. **`can-i-deploy` check**: Before updating the deployment repo's version pins, query the Pact Broker: "is user-service v1.8.0 compatible with frontend v4.2.0?"
|
|
99
|
+
|
|
100
|
+
### Contract testing in the deployment repo CI
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
# .github/workflows/validate-versions.yml (simplified)
|
|
104
|
+
name: Validate Version Compatibility
|
|
105
|
+
on:
|
|
106
|
+
pull_request:
|
|
107
|
+
paths: ['versions.yaml']
|
|
108
|
+
|
|
109
|
+
jobs:
|
|
110
|
+
contract-check:
|
|
111
|
+
steps:
|
|
112
|
+
- name: Read pinned versions
|
|
113
|
+
run: |
|
|
114
|
+
# Parse versions.yaml for all service versions
|
|
115
|
+
- name: Check Pact compatibility
|
|
116
|
+
run: |
|
|
117
|
+
pact-broker can-i-deploy \
|
|
118
|
+
--pacticipant api-gateway --version $API_GW_VERSION \
|
|
119
|
+
--pacticipant user-service --version $USER_SVC_VERSION \
|
|
120
|
+
--to-environment staging
|
|
121
|
+
- name: Run E2E smoke tests
|
|
122
|
+
run: |
|
|
123
|
+
docker compose up -d
|
|
124
|
+
npm run test:e2e
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Event schema compatibility
|
|
128
|
+
|
|
129
|
+
For event-driven services, use a schema registry (Confluent, AWS Glue, or a simple Git-based registry in the deployment repo):
|
|
130
|
+
|
|
131
|
+
- **Backward compatible**: New consumer can read old producer messages (add optional fields, don't remove fields)
|
|
132
|
+
- **Forward compatible**: Old consumer can read new producer messages (ignore unknown fields)
|
|
133
|
+
- **Full compatible**: Both directions work — this is the gold standard for event schemas
|
|
134
|
+
|
|
135
|
+
Store schemas in the deployment repo:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
contracts/
|
|
139
|
+
├── events/
|
|
140
|
+
│ ├── user-created.v1.avsc
|
|
141
|
+
│ ├── user-created.v2.avsc # Must be backward-compatible with v1
|
|
142
|
+
│ └── order-placed.v1.json
|
|
143
|
+
└── apis/
|
|
144
|
+
├── api-gateway.openapi.yaml
|
|
145
|
+
└── user-service.openapi.yaml
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
CI validates schema evolution on every PR.
|
|
149
|
+
|
|
150
|
+
## Breaking Change Coordination
|
|
151
|
+
|
|
152
|
+
When a breaking change is unavoidable (major version bump), the deployment repo coordinates the migration:
|
|
153
|
+
|
|
154
|
+
### Pattern: Coordinated multi-service bump
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
1. Provider deploys v2 alongside v1 (both endpoints active)
|
|
158
|
+
2. Deployment repo PR: bump provider to v2, update consumers to use v2
|
|
159
|
+
3. Contract tests verify all consumers work with provider v2
|
|
160
|
+
4. E2E tests pass with the new version set
|
|
161
|
+
5. Merge and promote through environments
|
|
162
|
+
6. After all environments stable: provider removes v1 support
|
|
163
|
+
7. Deployment repo PR: bump provider to v2.1 (v1 removed)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Pattern: Expand-contract for shared data
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
1. Expand: Add new column/field alongside old (backward compatible)
|
|
170
|
+
2. Deployment repo PR: bump service with migration, all other versions unchanged
|
|
171
|
+
3. Migrate: Update consumers one by one to use new field
|
|
172
|
+
4. Deployment repo PRs: bump each consumer as it's updated
|
|
173
|
+
5. Contract: Remove old field once all consumers migrated
|
|
174
|
+
6. Deployment repo PR: bump service with cleanup migration
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Version compatibility matrix
|
|
178
|
+
|
|
179
|
+
For complex systems, maintain an explicit compatibility matrix:
|
|
180
|
+
|
|
181
|
+
```yaml
|
|
182
|
+
# compatibility-matrix.yaml
|
|
183
|
+
api-gateway:
|
|
184
|
+
v2.x:
|
|
185
|
+
user-service: ">=v1.5.0, <v3.0.0"
|
|
186
|
+
billing-service: ">=v3.0.0"
|
|
187
|
+
v1.x:
|
|
188
|
+
user-service: ">=v1.0.0, <v2.0.0"
|
|
189
|
+
billing-service: ">=v2.0.0, <v3.0.0"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
CI uses this matrix to validate that the pinned versions in `versions.yaml` are within the declared compatibility ranges.
|
|
193
|
+
|
|
194
|
+
## Environment Promotion Workflows
|
|
195
|
+
|
|
196
|
+
### Git-based promotion (recommended)
|
|
197
|
+
|
|
198
|
+
Each environment has its own `versions.yaml` (or the deployment repo uses branches/directories per environment):
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
environments/
|
|
202
|
+
├── dev/
|
|
203
|
+
│ └── versions.yaml # Latest validated versions
|
|
204
|
+
├── staging/
|
|
205
|
+
│ └── versions.yaml # Promoted from dev after E2E pass
|
|
206
|
+
└── production/
|
|
207
|
+
└── versions.yaml # Promoted from staging after approval
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Promotion = copying versions.yaml from one environment to the next:**
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Promote dev to staging
|
|
214
|
+
cp environments/dev/versions.yaml environments/staging/versions.yaml
|
|
215
|
+
git commit -m "promote: dev version set -> staging"
|
|
216
|
+
# PR triggers staging E2E tests
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Automated promotion pipeline
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
dev: Auto-deploy on merge. E2E tests run post-deploy.
|
|
223
|
+
staging: Triggered by "promote to staging" PR. Full E2E + performance tests.
|
|
224
|
+
prod: Triggered by "promote to production" PR. Requires 2 approvals. Canary optional.
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Rollback at any stage = revert the promotion commit. The previous version set is restored.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Deployment Repo Structure Template
|
|
2
|
+
|
|
3
|
+
Use this template to scaffold a deployment repo. Choose the tier that matches your scale and adjust to fit.
|
|
4
|
+
|
|
5
|
+
## Lightweight Tier Scaffold
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
#!/bin/bash
|
|
9
|
+
# scaffold-lightweight.sh — Create a lightweight deployment repo
|
|
10
|
+
|
|
11
|
+
REPO_NAME="${1:-deployment-repo}"
|
|
12
|
+
mkdir -p "$REPO_NAME"/{tests/e2e,docs,scripts}
|
|
13
|
+
|
|
14
|
+
# Version pins
|
|
15
|
+
cat > "$REPO_NAME/.versions.env" << 'EOF'
|
|
16
|
+
# Service versions — the compatibility lock
|
|
17
|
+
# Update via: make bump-<service> VERSION=vX.Y.Z
|
|
18
|
+
API_VERSION=v0.1.0
|
|
19
|
+
FRONTEND_VERSION=v0.1.0
|
|
20
|
+
REGISTRY=ghcr.io/your-org
|
|
21
|
+
EOF
|
|
22
|
+
|
|
23
|
+
# Environment template
|
|
24
|
+
cat > "$REPO_NAME/.env.example" << 'EOF'
|
|
25
|
+
# Copy to .env and customize for local dev
|
|
26
|
+
POSTGRES_USER=devuser
|
|
27
|
+
POSTGRES_PASSWORD=devpass
|
|
28
|
+
POSTGRES_DB=app_dev
|
|
29
|
+
EOF
|
|
30
|
+
|
|
31
|
+
# Docker Compose
|
|
32
|
+
cat > "$REPO_NAME/docker-compose.yml" << 'EOF'
|
|
33
|
+
# Load service versions from .versions.env
|
|
34
|
+
# Usage: docker compose --env-file .versions.env up
|
|
35
|
+
|
|
36
|
+
services:
|
|
37
|
+
api:
|
|
38
|
+
image: ${REGISTRY}/api:${API_VERSION}
|
|
39
|
+
ports:
|
|
40
|
+
- "8000:8000"
|
|
41
|
+
env_file: .env
|
|
42
|
+
depends_on:
|
|
43
|
+
db:
|
|
44
|
+
condition: service_healthy
|
|
45
|
+
healthcheck:
|
|
46
|
+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
47
|
+
interval: 10s
|
|
48
|
+
retries: 3
|
|
49
|
+
|
|
50
|
+
frontend:
|
|
51
|
+
image: ${REGISTRY}/frontend:${FRONTEND_VERSION}
|
|
52
|
+
ports:
|
|
53
|
+
- "3000:3000"
|
|
54
|
+
environment:
|
|
55
|
+
API_URL: http://api:8000
|
|
56
|
+
depends_on:
|
|
57
|
+
api:
|
|
58
|
+
condition: service_healthy
|
|
59
|
+
|
|
60
|
+
db:
|
|
61
|
+
image: postgres:16-alpine
|
|
62
|
+
env_file: .env
|
|
63
|
+
volumes:
|
|
64
|
+
- pgdata:/var/lib/postgresql/data
|
|
65
|
+
healthcheck:
|
|
66
|
+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
|
|
67
|
+
interval: 5s
|
|
68
|
+
retries: 5
|
|
69
|
+
|
|
70
|
+
volumes:
|
|
71
|
+
pgdata:
|
|
72
|
+
EOF
|
|
73
|
+
|
|
74
|
+
# Makefile
|
|
75
|
+
cat > "$REPO_NAME/Makefile" << 'MAKEOF'
|
|
76
|
+
.PHONY: up down test logs setup health
|
|
77
|
+
|
|
78
|
+
up: ## Start all services
|
|
79
|
+
docker compose --env-file .versions.env up -d
|
|
80
|
+
|
|
81
|
+
down: ## Stop all services
|
|
82
|
+
docker compose down
|
|
83
|
+
|
|
84
|
+
test: ## Run E2E tests against running services
|
|
85
|
+
cd tests/e2e && npm test
|
|
86
|
+
|
|
87
|
+
logs: ## Tail all logs
|
|
88
|
+
docker compose logs -f
|
|
89
|
+
|
|
90
|
+
setup: ## First-time setup
|
|
91
|
+
cp .env.example .env
|
|
92
|
+
docker compose --env-file .versions.env build
|
|
93
|
+
$(MAKE) up
|
|
94
|
+
@echo "System is starting. Run 'make health' to check status."
|
|
95
|
+
|
|
96
|
+
health: ## Check all services are healthy
|
|
97
|
+
docker compose ps
|
|
98
|
+
|
|
99
|
+
bump-%: ## Bump a service version: make bump-api VERSION=v1.2.3
|
|
100
|
+
@if [ -z "$(VERSION)" ]; then echo "Usage: make bump-$* VERSION=vX.Y.Z"; exit 1; fi
|
|
101
|
+
sed -i 's/^$(shell echo $* | tr a-z A-Z)_VERSION=.*/$(shell echo $* | tr a-z A-Z)_VERSION=$(VERSION)/' .versions.env
|
|
102
|
+
@echo "Updated $* to $(VERSION) in .versions.env"
|
|
103
|
+
@echo "Run 'make up && make test' to validate."
|
|
104
|
+
MAKEOF
|
|
105
|
+
|
|
106
|
+
# Gitignore
|
|
107
|
+
cat > "$REPO_NAME/.gitignore" << 'EOF'
|
|
108
|
+
.env
|
|
109
|
+
docker-compose.override.yml
|
|
110
|
+
node_modules/
|
|
111
|
+
EOF
|
|
112
|
+
|
|
113
|
+
# README
|
|
114
|
+
cat > "$REPO_NAME/README.md" << 'EOF'
|
|
115
|
+
# Deployment Repo
|
|
116
|
+
|
|
117
|
+
Single source of truth for the system's deployment configuration.
|
|
118
|
+
|
|
119
|
+
## Quick Start
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
make setup # First-time: copies .env, builds, starts services
|
|
123
|
+
make up # Start all services
|
|
124
|
+
make test # Run E2E tests
|
|
125
|
+
make down # Stop all services
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Updating Service Versions
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
make bump-api VERSION=v1.2.3
|
|
132
|
+
make up && make test
|
|
133
|
+
git add .versions.env && git commit -m "bump api to v1.2.3"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Adding a New Service
|
|
137
|
+
|
|
138
|
+
1. Add the service to `docker-compose.yml`
|
|
139
|
+
2. Add its version to `.versions.env`
|
|
140
|
+
3. Update E2E tests in `tests/e2e/`
|
|
141
|
+
4. Document in this README
|
|
142
|
+
EOF
|
|
143
|
+
|
|
144
|
+
echo "Scaffolded $REPO_NAME (lightweight tier)"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Standard Tier Scaffold
|
|
148
|
+
|
|
149
|
+
Extends lightweight with Helm, contract testing, and environment promotion:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
#!/bin/bash
|
|
153
|
+
# scaffold-standard.sh — Extend lightweight with Helm and contracts
|
|
154
|
+
|
|
155
|
+
REPO_NAME="${1:-deployment-repo}"
|
|
156
|
+
|
|
157
|
+
# Run lightweight scaffold first, then add:
|
|
158
|
+
mkdir -p "$REPO_NAME"/{helm/values,contracts/{apis,events},tests/{e2e,contract}}
|
|
159
|
+
mkdir -p "$REPO_NAME"/environments/{dev,staging,production}
|
|
160
|
+
mkdir -p "$REPO_NAME"/{ci,infrastructure/terraform,docs/{architecture/adr,runbooks}}
|
|
161
|
+
|
|
162
|
+
# versions.yaml (replaces .versions.env for standard tier)
|
|
163
|
+
cat > "$REPO_NAME/versions.yaml" << 'EOF'
|
|
164
|
+
# The compatibility lock — pinned service versions validated together
|
|
165
|
+
services:
|
|
166
|
+
api-gateway:
|
|
167
|
+
image: registry.example.com/api-gateway
|
|
168
|
+
version: v1.0.0
|
|
169
|
+
user-service:
|
|
170
|
+
image: registry.example.com/user-service
|
|
171
|
+
version: v1.0.0
|
|
172
|
+
frontend:
|
|
173
|
+
image: registry.example.com/frontend
|
|
174
|
+
version: v1.0.0
|
|
175
|
+
|
|
176
|
+
validated:
|
|
177
|
+
timestamp: null
|
|
178
|
+
contract_tests: pending
|
|
179
|
+
e2e_tests: pending
|
|
180
|
+
EOF
|
|
181
|
+
|
|
182
|
+
# Per-environment versions
|
|
183
|
+
for env in dev staging production; do
|
|
184
|
+
cp "$REPO_NAME/versions.yaml" "$REPO_NAME/environments/$env/versions.yaml"
|
|
185
|
+
done
|
|
186
|
+
|
|
187
|
+
# Helm umbrella chart
|
|
188
|
+
cat > "$REPO_NAME/helm/Chart.yaml" << 'EOF'
|
|
189
|
+
apiVersion: v2
|
|
190
|
+
name: system
|
|
191
|
+
description: Umbrella chart for the full system
|
|
192
|
+
version: 1.0.0
|
|
193
|
+
dependencies:
|
|
194
|
+
- name: api-gateway
|
|
195
|
+
version: "1.0.0"
|
|
196
|
+
repository: "oci://registry.example.com/charts"
|
|
197
|
+
- name: user-service
|
|
198
|
+
version: "1.0.0"
|
|
199
|
+
repository: "oci://registry.example.com/charts"
|
|
200
|
+
EOF
|
|
201
|
+
|
|
202
|
+
echo "Scaffolded $REPO_NAME (standard tier)"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Promotion Template
|
|
206
|
+
|
|
207
|
+
PR template for environment promotion:
|
|
208
|
+
|
|
209
|
+
```markdown
|
|
210
|
+
## Promotion: [source] -> [target]
|
|
211
|
+
|
|
212
|
+
### Version changes
|
|
213
|
+
<!-- Diff of versions.yaml between environments -->
|
|
214
|
+
|
|
215
|
+
### Validation
|
|
216
|
+
- [ ] Contract tests pass in source environment
|
|
217
|
+
- [ ] E2E tests pass in source environment
|
|
218
|
+
- [ ] No open incidents related to these versions
|
|
219
|
+
- [ ] Rollback plan reviewed (revert this commit)
|
|
220
|
+
|
|
221
|
+
### Services affected
|
|
222
|
+
| Service | Previous | New | Change type |
|
|
223
|
+
|---------|----------|-----|-------------|
|
|
224
|
+
| api-gateway | v2.3.0 | v2.3.1 | Patch (bug fix) |
|
|
225
|
+
| user-service | v1.7.0 | v1.7.0 | No change |
|
|
226
|
+
```
|