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,478 @@
|
|
|
1
|
+
# GitOps Patterns Reference
|
|
2
|
+
|
|
3
|
+
## ArgoCD Patterns
|
|
4
|
+
|
|
5
|
+
### Application Resource (Complete Example)
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
apiVersion: argoproj.io/v1alpha1
|
|
9
|
+
kind: Application
|
|
10
|
+
metadata:
|
|
11
|
+
name: user-service-staging
|
|
12
|
+
namespace: argocd
|
|
13
|
+
labels:
|
|
14
|
+
app.kubernetes.io/part-of: platform
|
|
15
|
+
environment: staging
|
|
16
|
+
# Finalizer ensures resources are cleaned up when Application is deleted
|
|
17
|
+
finalizers:
|
|
18
|
+
- resources-finalizer.argocd.argoproj.io
|
|
19
|
+
spec:
|
|
20
|
+
project: platform # ArgoCD project for RBAC scoping
|
|
21
|
+
|
|
22
|
+
source:
|
|
23
|
+
repoURL: https://github.com/org/deployment-repo
|
|
24
|
+
targetRevision: main
|
|
25
|
+
path: helm/user-service
|
|
26
|
+
helm:
|
|
27
|
+
valueFiles:
|
|
28
|
+
- ../../environments/staging/user-service-values.yaml
|
|
29
|
+
# Override specific values inline
|
|
30
|
+
parameters:
|
|
31
|
+
- name: image.tag
|
|
32
|
+
value: "v1.7.0"
|
|
33
|
+
|
|
34
|
+
destination:
|
|
35
|
+
server: https://kubernetes.default.svc
|
|
36
|
+
namespace: staging
|
|
37
|
+
|
|
38
|
+
syncPolicy:
|
|
39
|
+
automated:
|
|
40
|
+
prune: true # Delete resources removed from Git
|
|
41
|
+
selfHeal: true # Revert manual cluster changes
|
|
42
|
+
allowEmpty: false # Don't sync if source is empty (safety)
|
|
43
|
+
syncOptions:
|
|
44
|
+
- CreateNamespace=true
|
|
45
|
+
- PrunePropagationPolicy=foreground
|
|
46
|
+
- PruneLast=true # Prune after other syncs complete
|
|
47
|
+
retry:
|
|
48
|
+
limit: 5
|
|
49
|
+
backoff:
|
|
50
|
+
duration: 5s
|
|
51
|
+
factor: 2
|
|
52
|
+
maxDuration: 3m
|
|
53
|
+
|
|
54
|
+
# Health checks beyond default K8s readiness
|
|
55
|
+
ignoreDifferences:
|
|
56
|
+
- group: apps
|
|
57
|
+
kind: Deployment
|
|
58
|
+
jsonPointers:
|
|
59
|
+
- /spec/replicas # Ignore HPA-managed replicas
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### App of Apps Pattern
|
|
63
|
+
|
|
64
|
+
The "App of Apps" pattern uses one root Application that manages all other Applications:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
# argocd/root.yaml — the root Application
|
|
68
|
+
apiVersion: argoproj.io/v1alpha1
|
|
69
|
+
kind: Application
|
|
70
|
+
metadata:
|
|
71
|
+
name: platform-staging
|
|
72
|
+
namespace: argocd
|
|
73
|
+
spec:
|
|
74
|
+
project: platform
|
|
75
|
+
source:
|
|
76
|
+
repoURL: https://github.com/org/deployment-repo
|
|
77
|
+
targetRevision: main
|
|
78
|
+
path: argocd/staging # Contains Application YAMLs for all services
|
|
79
|
+
destination:
|
|
80
|
+
server: https://kubernetes.default.svc
|
|
81
|
+
namespace: argocd
|
|
82
|
+
syncPolicy:
|
|
83
|
+
automated:
|
|
84
|
+
prune: true
|
|
85
|
+
selfHeal: true
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Benefits:
|
|
89
|
+
- Add a new service by adding an Application YAML to the directory
|
|
90
|
+
- All Applications are version-controlled and managed declaratively
|
|
91
|
+
- Single point of entry for the platform
|
|
92
|
+
|
|
93
|
+
### ApplicationSet (Dynamic Application Generation)
|
|
94
|
+
|
|
95
|
+
For enterprise setups with many services and environments:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
apiVersion: argoproj.io/v1alpha1
|
|
99
|
+
kind: ApplicationSet
|
|
100
|
+
metadata:
|
|
101
|
+
name: platform-services
|
|
102
|
+
namespace: argocd
|
|
103
|
+
spec:
|
|
104
|
+
generators:
|
|
105
|
+
- matrix:
|
|
106
|
+
generators:
|
|
107
|
+
- git:
|
|
108
|
+
repoURL: https://github.com/org/deployment-repo
|
|
109
|
+
revision: main
|
|
110
|
+
directories:
|
|
111
|
+
- path: helm/* # Each subdirectory = a service
|
|
112
|
+
- list:
|
|
113
|
+
elements:
|
|
114
|
+
- environment: staging
|
|
115
|
+
cluster: https://staging.k8s.local
|
|
116
|
+
autoSync: "true"
|
|
117
|
+
- environment: production
|
|
118
|
+
cluster: https://prod.k8s.local
|
|
119
|
+
autoSync: "false"
|
|
120
|
+
template:
|
|
121
|
+
metadata:
|
|
122
|
+
name: "{{path.basename}}-{{environment}}"
|
|
123
|
+
spec:
|
|
124
|
+
project: platform
|
|
125
|
+
source:
|
|
126
|
+
repoURL: https://github.com/org/deployment-repo
|
|
127
|
+
targetRevision: main
|
|
128
|
+
path: "{{path}}"
|
|
129
|
+
helm:
|
|
130
|
+
valueFiles:
|
|
131
|
+
- "../../environments/{{environment}}/{{path.basename}}-values.yaml"
|
|
132
|
+
destination:
|
|
133
|
+
server: "{{cluster}}"
|
|
134
|
+
namespace: "{{environment}}"
|
|
135
|
+
syncPolicy:
|
|
136
|
+
automated:
|
|
137
|
+
prune: "{{autoSync}}"
|
|
138
|
+
selfHeal: "{{autoSync}}"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Sync Waves (Deployment Ordering)
|
|
142
|
+
|
|
143
|
+
Control the order resources are applied:
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
# Wave 0: Namespace and config (applied first)
|
|
147
|
+
apiVersion: v1
|
|
148
|
+
kind: Namespace
|
|
149
|
+
metadata:
|
|
150
|
+
name: staging
|
|
151
|
+
annotations:
|
|
152
|
+
argocd.argoproj.io/sync-wave: "0"
|
|
153
|
+
---
|
|
154
|
+
# Wave 1: Database migration job
|
|
155
|
+
apiVersion: batch/v1
|
|
156
|
+
kind: Job
|
|
157
|
+
metadata:
|
|
158
|
+
name: db-migrate
|
|
159
|
+
annotations:
|
|
160
|
+
argocd.argoproj.io/sync-wave: "1"
|
|
161
|
+
argocd.argoproj.io/hook: PreSync # Run before main sync
|
|
162
|
+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
|
|
163
|
+
---
|
|
164
|
+
# Wave 2: Backend services
|
|
165
|
+
apiVersion: apps/v1
|
|
166
|
+
kind: Deployment
|
|
167
|
+
metadata:
|
|
168
|
+
name: user-service
|
|
169
|
+
annotations:
|
|
170
|
+
argocd.argoproj.io/sync-wave: "2"
|
|
171
|
+
---
|
|
172
|
+
# Wave 3: Frontend (depends on backend)
|
|
173
|
+
apiVersion: apps/v1
|
|
174
|
+
kind: Deployment
|
|
175
|
+
metadata:
|
|
176
|
+
name: frontend
|
|
177
|
+
annotations:
|
|
178
|
+
argocd.argoproj.io/sync-wave: "3"
|
|
179
|
+
---
|
|
180
|
+
# Wave 4: Ingress (after services are healthy)
|
|
181
|
+
apiVersion: networking.k8s.io/v1
|
|
182
|
+
kind: Ingress
|
|
183
|
+
metadata:
|
|
184
|
+
name: platform-ingress
|
|
185
|
+
annotations:
|
|
186
|
+
argocd.argoproj.io/sync-wave: "4"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### RBAC Configuration
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
# ArgoCD project for team isolation
|
|
193
|
+
apiVersion: argoproj.io/v1alpha1
|
|
194
|
+
kind: AppProject
|
|
195
|
+
metadata:
|
|
196
|
+
name: platform
|
|
197
|
+
namespace: argocd
|
|
198
|
+
spec:
|
|
199
|
+
description: Platform services
|
|
200
|
+
sourceRepos:
|
|
201
|
+
- https://github.com/org/deployment-repo
|
|
202
|
+
destinations:
|
|
203
|
+
- namespace: staging
|
|
204
|
+
server: https://kubernetes.default.svc
|
|
205
|
+
- namespace: production
|
|
206
|
+
server: https://kubernetes.default.svc
|
|
207
|
+
# Restrict what can be deployed
|
|
208
|
+
clusterResourceWhitelist:
|
|
209
|
+
- group: ""
|
|
210
|
+
kind: Namespace
|
|
211
|
+
namespaceResourceWhitelist:
|
|
212
|
+
- group: "apps"
|
|
213
|
+
kind: Deployment
|
|
214
|
+
- group: ""
|
|
215
|
+
kind: Service
|
|
216
|
+
- group: "networking.k8s.io"
|
|
217
|
+
kind: Ingress
|
|
218
|
+
# Roles
|
|
219
|
+
roles:
|
|
220
|
+
- name: deployer
|
|
221
|
+
description: Can sync applications
|
|
222
|
+
policies:
|
|
223
|
+
- p, proj:platform:deployer, applications, sync, platform/*, allow
|
|
224
|
+
- p, proj:platform:deployer, applications, get, platform/*, allow
|
|
225
|
+
groups:
|
|
226
|
+
- platform-team
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Sync Windows (Maintenance Windows)
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
# In the AppProject spec
|
|
233
|
+
spec:
|
|
234
|
+
syncWindows:
|
|
235
|
+
- kind: allow
|
|
236
|
+
schedule: "0 8-18 * * 1-5" # Allow sync Mon-Fri 8am-6pm
|
|
237
|
+
duration: 10h
|
|
238
|
+
applications:
|
|
239
|
+
- "*-production"
|
|
240
|
+
- kind: deny
|
|
241
|
+
schedule: "0 0 * * 0" # Deny sync on Sundays
|
|
242
|
+
duration: 24h
|
|
243
|
+
applications:
|
|
244
|
+
- "*-production"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Flux Patterns
|
|
248
|
+
|
|
249
|
+
### GitRepository Source
|
|
250
|
+
|
|
251
|
+
```yaml
|
|
252
|
+
apiVersion: source.toolkit.fluxcd.io/v1
|
|
253
|
+
kind: GitRepository
|
|
254
|
+
metadata:
|
|
255
|
+
name: deployment-repo
|
|
256
|
+
namespace: flux-system
|
|
257
|
+
spec:
|
|
258
|
+
interval: 1m
|
|
259
|
+
url: https://github.com/org/deployment-repo
|
|
260
|
+
ref:
|
|
261
|
+
branch: main
|
|
262
|
+
secretRef:
|
|
263
|
+
name: deployment-repo-auth
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Kustomization (Flux)
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
270
|
+
kind: Kustomization
|
|
271
|
+
metadata:
|
|
272
|
+
name: staging-infrastructure
|
|
273
|
+
namespace: flux-system
|
|
274
|
+
spec:
|
|
275
|
+
interval: 10m
|
|
276
|
+
retryInterval: 1m
|
|
277
|
+
timeout: 5m
|
|
278
|
+
sourceRef:
|
|
279
|
+
kind: GitRepository
|
|
280
|
+
name: deployment-repo
|
|
281
|
+
path: ./infrastructure/staging
|
|
282
|
+
prune: true
|
|
283
|
+
wait: true
|
|
284
|
+
healthChecks:
|
|
285
|
+
- apiVersion: apps/v1
|
|
286
|
+
kind: Deployment
|
|
287
|
+
name: user-service
|
|
288
|
+
namespace: staging
|
|
289
|
+
# Dependencies: infra must be ready before apps
|
|
290
|
+
dependsOn:
|
|
291
|
+
- name: staging-namespaces
|
|
292
|
+
---
|
|
293
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
294
|
+
kind: Kustomization
|
|
295
|
+
metadata:
|
|
296
|
+
name: staging-apps
|
|
297
|
+
namespace: flux-system
|
|
298
|
+
spec:
|
|
299
|
+
interval: 10m
|
|
300
|
+
sourceRef:
|
|
301
|
+
kind: GitRepository
|
|
302
|
+
name: deployment-repo
|
|
303
|
+
path: ./overlays/staging
|
|
304
|
+
prune: true
|
|
305
|
+
dependsOn:
|
|
306
|
+
- name: staging-infrastructure
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Image Automation (Flux)
|
|
310
|
+
|
|
311
|
+
Flux can automatically detect new image tags and update the deployment repo:
|
|
312
|
+
|
|
313
|
+
```yaml
|
|
314
|
+
# Watch the registry for new tags
|
|
315
|
+
apiVersion: image.toolkit.fluxcd.io/v1beta2
|
|
316
|
+
kind: ImageRepository
|
|
317
|
+
metadata:
|
|
318
|
+
name: user-service
|
|
319
|
+
namespace: flux-system
|
|
320
|
+
spec:
|
|
321
|
+
image: ghcr.io/org/user-service
|
|
322
|
+
interval: 5m
|
|
323
|
+
---
|
|
324
|
+
# Policy: use latest semver tag
|
|
325
|
+
apiVersion: image.toolkit.fluxcd.io/v1beta2
|
|
326
|
+
kind: ImagePolicy
|
|
327
|
+
metadata:
|
|
328
|
+
name: user-service
|
|
329
|
+
namespace: flux-system
|
|
330
|
+
spec:
|
|
331
|
+
imageRepositoryRef:
|
|
332
|
+
name: user-service
|
|
333
|
+
policy:
|
|
334
|
+
semver:
|
|
335
|
+
range: ">=1.0.0"
|
|
336
|
+
---
|
|
337
|
+
# Auto-update: commit new tags back to the deployment repo
|
|
338
|
+
apiVersion: image.toolkit.fluxcd.io/v1beta1
|
|
339
|
+
kind: ImageUpdateAutomation
|
|
340
|
+
metadata:
|
|
341
|
+
name: deployment-repo-update
|
|
342
|
+
namespace: flux-system
|
|
343
|
+
spec:
|
|
344
|
+
interval: 5m
|
|
345
|
+
sourceRef:
|
|
346
|
+
kind: GitRepository
|
|
347
|
+
name: deployment-repo
|
|
348
|
+
git:
|
|
349
|
+
checkout:
|
|
350
|
+
ref:
|
|
351
|
+
branch: main
|
|
352
|
+
commit:
|
|
353
|
+
author:
|
|
354
|
+
name: flux-bot
|
|
355
|
+
email: flux@org.com
|
|
356
|
+
messageTemplate: "bump {{ range .Updated.Images }}{{ .}} {{ end }}"
|
|
357
|
+
push:
|
|
358
|
+
branch: main
|
|
359
|
+
update:
|
|
360
|
+
path: ./environments/dev
|
|
361
|
+
strategy: Setters
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Cross-Repo Trigger Patterns
|
|
365
|
+
|
|
366
|
+
### GitHub Actions: Complete Trigger Flow
|
|
367
|
+
|
|
368
|
+
**App repo (sender):**
|
|
369
|
+
|
|
370
|
+
```yaml
|
|
371
|
+
# .github/workflows/release.yml
|
|
372
|
+
name: Release
|
|
373
|
+
on:
|
|
374
|
+
push:
|
|
375
|
+
tags: ['v*']
|
|
376
|
+
|
|
377
|
+
jobs:
|
|
378
|
+
build-and-push:
|
|
379
|
+
runs-on: ubuntu-latest
|
|
380
|
+
steps:
|
|
381
|
+
- uses: actions/checkout@v4
|
|
382
|
+
|
|
383
|
+
- name: Build and push Docker image
|
|
384
|
+
uses: docker/build-push-action@v5
|
|
385
|
+
with:
|
|
386
|
+
push: true
|
|
387
|
+
tags: ghcr.io/org/user-service:${{ github.ref_name }}
|
|
388
|
+
|
|
389
|
+
- name: Trigger deployment repo update
|
|
390
|
+
uses: peter-evans/repository-dispatch@v3
|
|
391
|
+
with:
|
|
392
|
+
token: ${{ secrets.DEPLOY_REPO_PAT }}
|
|
393
|
+
repository: org/deployment-repo
|
|
394
|
+
event-type: version-bump
|
|
395
|
+
client-payload: >
|
|
396
|
+
{
|
|
397
|
+
"service": "user-service",
|
|
398
|
+
"version": "${{ github.ref_name }}",
|
|
399
|
+
"image": "ghcr.io/org/user-service:${{ github.ref_name }}",
|
|
400
|
+
"commit_sha": "${{ github.sha }}",
|
|
401
|
+
"commit_message": "${{ github.event.head_commit.message }}"
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Deployment repo (receiver):**
|
|
406
|
+
|
|
407
|
+
```yaml
|
|
408
|
+
# .github/workflows/version-bump.yml
|
|
409
|
+
name: Version Bump
|
|
410
|
+
on:
|
|
411
|
+
repository_dispatch:
|
|
412
|
+
types: [version-bump]
|
|
413
|
+
|
|
414
|
+
jobs:
|
|
415
|
+
create-bump-pr:
|
|
416
|
+
runs-on: ubuntu-latest
|
|
417
|
+
steps:
|
|
418
|
+
- uses: actions/checkout@v4
|
|
419
|
+
|
|
420
|
+
- name: Update versions.yaml
|
|
421
|
+
run: |
|
|
422
|
+
SERVICE="${{ github.event.client_payload.service }}"
|
|
423
|
+
VERSION="${{ github.event.client_payload.version }}"
|
|
424
|
+
yq e ".services.${SERVICE}.version = \"${VERSION}\"" -i environments/dev/versions.yaml
|
|
425
|
+
|
|
426
|
+
- name: Create Pull Request
|
|
427
|
+
uses: peter-evans/create-pull-request@v6
|
|
428
|
+
with:
|
|
429
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
430
|
+
title: "bump ${{ github.event.client_payload.service }} to ${{ github.event.client_payload.version }}"
|
|
431
|
+
body: |
|
|
432
|
+
Automated version bump triggered by [${{ github.event.client_payload.service }}](https://github.com/org/${{ github.event.client_payload.service }}/commit/${{ github.event.client_payload.commit_sha }}).
|
|
433
|
+
|
|
434
|
+
**Service:** ${{ github.event.client_payload.service }}
|
|
435
|
+
**Version:** ${{ github.event.client_payload.version }}
|
|
436
|
+
**Commit:** ${{ github.event.client_payload.commit_message }}
|
|
437
|
+
branch: "bump/${{ github.event.client_payload.service }}-${{ github.event.client_payload.version }}"
|
|
438
|
+
labels: version-bump,automated
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## Drift Detection and Remediation
|
|
442
|
+
|
|
443
|
+
### ArgoCD drift behavior
|
|
444
|
+
|
|
445
|
+
- **selfHeal: true** — ArgoCD reverts any manual cluster change within the sync interval (default 3 minutes)
|
|
446
|
+
- **selfHeal: false** — ArgoCD detects drift and shows it in the UI but doesn't auto-fix
|
|
447
|
+
- **Notifications on drift**: Configure ArgoCD Notifications to alert on `OutOfSync` status
|
|
448
|
+
|
|
449
|
+
```yaml
|
|
450
|
+
# ArgoCD Notification trigger
|
|
451
|
+
apiVersion: argoproj.io/v1alpha1
|
|
452
|
+
kind: Application
|
|
453
|
+
metadata:
|
|
454
|
+
annotations:
|
|
455
|
+
notifications.argoproj.io/subscribe.on-sync-status-unknown.slack: platform-alerts
|
|
456
|
+
notifications.argoproj.io/subscribe.on-health-degraded.slack: platform-alerts
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Flux drift behavior
|
|
460
|
+
|
|
461
|
+
- **prune: true** — Flux removes resources that exist in the cluster but not in Git
|
|
462
|
+
- **force: true** — Flux recreates resources that can't be patched (use carefully)
|
|
463
|
+
- **Alerts**: Flux native alert provider
|
|
464
|
+
|
|
465
|
+
```yaml
|
|
466
|
+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
|
467
|
+
kind: Alert
|
|
468
|
+
metadata:
|
|
469
|
+
name: drift-alert
|
|
470
|
+
namespace: flux-system
|
|
471
|
+
spec:
|
|
472
|
+
providerRef:
|
|
473
|
+
name: slack
|
|
474
|
+
eventSeverity: error
|
|
475
|
+
eventSources:
|
|
476
|
+
- kind: Kustomization
|
|
477
|
+
name: "*"
|
|
478
|
+
```
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# GitOps Configuration Templates
|
|
2
|
+
|
|
3
|
+
Ready-to-use templates. Replace placeholders (`<org>`, `<service>`, `<env>`) with your values.
|
|
4
|
+
|
|
5
|
+
## ArgoCD Application Template
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
apiVersion: argoproj.io/v1alpha1
|
|
9
|
+
kind: Application
|
|
10
|
+
metadata:
|
|
11
|
+
name: <service>-<env>
|
|
12
|
+
namespace: argocd
|
|
13
|
+
labels:
|
|
14
|
+
environment: <env>
|
|
15
|
+
service: <service>
|
|
16
|
+
finalizers:
|
|
17
|
+
- resources-finalizer.argocd.argoproj.io
|
|
18
|
+
spec:
|
|
19
|
+
project: <project-name>
|
|
20
|
+
source:
|
|
21
|
+
repoURL: https://github.com/<org>/deployment-repo
|
|
22
|
+
targetRevision: main
|
|
23
|
+
path: helm/<service>
|
|
24
|
+
helm:
|
|
25
|
+
valueFiles:
|
|
26
|
+
- ../../environments/<env>/<service>-values.yaml
|
|
27
|
+
destination:
|
|
28
|
+
server: https://kubernetes.default.svc
|
|
29
|
+
namespace: <env>
|
|
30
|
+
syncPolicy:
|
|
31
|
+
# For staging: uncomment automated block
|
|
32
|
+
# For production: leave syncPolicy empty (manual sync)
|
|
33
|
+
automated:
|
|
34
|
+
prune: true
|
|
35
|
+
selfHeal: true
|
|
36
|
+
syncOptions:
|
|
37
|
+
- CreateNamespace=true
|
|
38
|
+
retry:
|
|
39
|
+
limit: 3
|
|
40
|
+
backoff:
|
|
41
|
+
duration: 5s
|
|
42
|
+
factor: 2
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Flux Kustomization Template
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
apiVersion: source.toolkit.fluxcd.io/v1
|
|
49
|
+
kind: GitRepository
|
|
50
|
+
metadata:
|
|
51
|
+
name: deployment-repo
|
|
52
|
+
namespace: flux-system
|
|
53
|
+
spec:
|
|
54
|
+
interval: 1m
|
|
55
|
+
url: https://github.com/<org>/deployment-repo
|
|
56
|
+
ref:
|
|
57
|
+
branch: main
|
|
58
|
+
secretRef:
|
|
59
|
+
name: deployment-repo-auth
|
|
60
|
+
---
|
|
61
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
62
|
+
kind: Kustomization
|
|
63
|
+
metadata:
|
|
64
|
+
name: <env>-apps
|
|
65
|
+
namespace: flux-system
|
|
66
|
+
spec:
|
|
67
|
+
interval: 10m
|
|
68
|
+
sourceRef:
|
|
69
|
+
kind: GitRepository
|
|
70
|
+
name: deployment-repo
|
|
71
|
+
path: ./overlays/<env>
|
|
72
|
+
prune: true
|
|
73
|
+
wait: true
|
|
74
|
+
timeout: 5m
|
|
75
|
+
healthChecks:
|
|
76
|
+
- apiVersion: apps/v1
|
|
77
|
+
kind: Deployment
|
|
78
|
+
name: <service>
|
|
79
|
+
namespace: <env>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Cross-Repo Trigger Workflow (GitHub Actions)
|
|
83
|
+
|
|
84
|
+
### App repo side (add to your release workflow)
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
# Add this step after building and pushing the Docker image
|
|
88
|
+
- name: Trigger deployment repo update
|
|
89
|
+
uses: peter-evans/repository-dispatch@v3
|
|
90
|
+
with:
|
|
91
|
+
token: ${{ secrets.DEPLOY_REPO_PAT }} # PAT with repo scope on deployment repo
|
|
92
|
+
repository: <org>/deployment-repo
|
|
93
|
+
event-type: version-bump
|
|
94
|
+
client-payload: >
|
|
95
|
+
{
|
|
96
|
+
"service": "<service>",
|
|
97
|
+
"version": "${{ github.ref_name }}",
|
|
98
|
+
"image": "ghcr.io/<org>/<service>:${{ github.ref_name }}",
|
|
99
|
+
"commit_sha": "${{ github.sha }}"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Deployment repo side (version-bump receiver)
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
name: Version Bump
|
|
107
|
+
on:
|
|
108
|
+
repository_dispatch:
|
|
109
|
+
types: [version-bump]
|
|
110
|
+
|
|
111
|
+
jobs:
|
|
112
|
+
create-bump-pr:
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/checkout@v4
|
|
116
|
+
|
|
117
|
+
- name: Update versions
|
|
118
|
+
run: |
|
|
119
|
+
SERVICE="${{ github.event.client_payload.service }}"
|
|
120
|
+
VERSION="${{ github.event.client_payload.version }}"
|
|
121
|
+
yq e ".services.${SERVICE}.version = \"${VERSION}\"" \
|
|
122
|
+
-i environments/dev/versions.yaml
|
|
123
|
+
|
|
124
|
+
- name: Create PR
|
|
125
|
+
uses: peter-evans/create-pull-request@v6
|
|
126
|
+
with:
|
|
127
|
+
title: "bump ${{ github.event.client_payload.service }} to ${{ github.event.client_payload.version }}"
|
|
128
|
+
branch: "bump/${{ github.event.client_payload.service }}-${{ github.event.client_payload.version }}"
|
|
129
|
+
labels: version-bump,automated
|
|
130
|
+
body: |
|
|
131
|
+
Automated version bump from app repo CI.
|
|
132
|
+
|
|
133
|
+
**Service:** ${{ github.event.client_payload.service }}
|
|
134
|
+
**Version:** ${{ github.event.client_payload.version }}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Renovate Config (Automated Image Tag Updates)
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
142
|
+
"extends": ["config:base"],
|
|
143
|
+
"kubernetes": {
|
|
144
|
+
"fileMatch": ["environments/.+\\.yaml$"]
|
|
145
|
+
},
|
|
146
|
+
"packageRules": [
|
|
147
|
+
{
|
|
148
|
+
"matchDatasources": ["docker"],
|
|
149
|
+
"matchPackagePatterns": ["ghcr.io/<org>/*"],
|
|
150
|
+
"groupName": "service-images",
|
|
151
|
+
"automerge": false,
|
|
152
|
+
"labels": ["version-bump", "automated"],
|
|
153
|
+
"schedule": ["every weekday"]
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Environment Promotion Workflow
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
name: Promote to Staging
|
|
163
|
+
on:
|
|
164
|
+
workflow_dispatch:
|
|
165
|
+
inputs:
|
|
166
|
+
source_env:
|
|
167
|
+
description: "Source environment"
|
|
168
|
+
default: "dev"
|
|
169
|
+
target_env:
|
|
170
|
+
description: "Target environment"
|
|
171
|
+
default: "staging"
|
|
172
|
+
|
|
173
|
+
jobs:
|
|
174
|
+
promote:
|
|
175
|
+
runs-on: ubuntu-latest
|
|
176
|
+
steps:
|
|
177
|
+
- uses: actions/checkout@v4
|
|
178
|
+
|
|
179
|
+
- name: Copy version set
|
|
180
|
+
run: |
|
|
181
|
+
cp environments/${{ inputs.source_env }}/versions.yaml \
|
|
182
|
+
environments/${{ inputs.target_env }}/versions.yaml
|
|
183
|
+
|
|
184
|
+
- name: Create promotion PR
|
|
185
|
+
uses: peter-evans/create-pull-request@v6
|
|
186
|
+
with:
|
|
187
|
+
title: "promote: ${{ inputs.source_env }} -> ${{ inputs.target_env }}"
|
|
188
|
+
branch: "promote/${{ inputs.source_env }}-to-${{ inputs.target_env }}"
|
|
189
|
+
labels: promotion
|
|
190
|
+
body: |
|
|
191
|
+
Promoting version set from **${{ inputs.source_env }}** to **${{ inputs.target_env }}**.
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
$(diff environments/${{ inputs.source_env }}/versions.yaml environments/${{ inputs.target_env }}/versions.yaml || true)
|
|
195
|
+
```
|
|
196
|
+
```
|