@logickernel/agileflow 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.
@@ -0,0 +1,390 @@
1
+ # Migration Guide
2
+
3
+ This guide helps you transition from traditional CI/CD approaches to AgileFlow's version-centric methodology. Whether you're using GitLab CI, GitHub Actions, or other CI/CD tools, this guide will walk you through the migration process.
4
+
5
+ ## Understanding the Migration
6
+
7
+ ### What You're Moving From
8
+
9
+ Traditional CI/CD pipelines typically use:
10
+ - **Branch-based environments** (staging branch, production branch)
11
+ - **Environment-specific deployments** (different code in different environments)
12
+ - **Manual version management** (hand-editing version numbers)
13
+ - **Complex branching strategies** (GitFlow, GitHub Flow variations)
14
+
15
+ ### What You're Moving To
16
+
17
+ AgileFlow provides:
18
+ - **Version-centric deployments** (same version everywhere)
19
+ - **Automatic version generation** (based on commit history)
20
+ - **Simplified branching** (main branch + feature branches)
21
+ - **Consistent environments** (no more environment drift)
22
+
23
+ ## Migration Strategy
24
+
25
+ ### Phase 1: Preparation (Week 1)
26
+
27
+ #### 1. Team Training
28
+ - **Train team members** on conventional commits
29
+ - **Explain the new workflow** and benefits
30
+ - **Provide examples** of good vs. bad commit messages
31
+ - **Set up commit message templates** in your IDE
32
+
33
+ #### 2. Repository Preparation
34
+ - **Clean up existing branches** (merge or delete old environment branches)
35
+ - **Ensure main branch** is the primary development branch
36
+ - **Review existing tags** and versioning strategy
37
+ - **Backup current CI/CD configuration**
38
+
39
+ #### 3. Environment Planning
40
+ - **Identify all environments** (dev, staging, production, etc.)
41
+ - **Document current deployment processes**
42
+ - **Plan configuration management** (environment variables, secrets)
43
+ - **Design rollback procedures**
44
+
45
+ ### Phase 2: Implementation (Week 2-3)
46
+
47
+ #### 1. Add AgileFlow Template
48
+ ```yaml
49
+ # .gitlab-ci.yml
50
+ include:
51
+ - local: templates/AgileFlow.gitlab-ci.yml
52
+
53
+ # Keep existing jobs for now
54
+ build:
55
+ stage: build
56
+ script:
57
+ - echo "Building from branch ${CI_COMMIT_REF_NAME}"
58
+ ```
59
+
60
+ #### 2. Configure Environment Variables
61
+ Set up required AgileFlow variables:
62
+ - `GITLAB_USER_NAME`
63
+ - `GITLAB_USER_EMAIL`
64
+ - `CI_SERVER_HOST`
65
+ - `CI_PROJECT_PATH`
66
+ - `AGILEFLOW_TOKEN`
67
+
68
+ #### 3. Test Version Generation
69
+ - **Commit a simple change** with conventional commit format
70
+ - **Verify the `agileflow` job** completes successfully
71
+ - **Check that version tags** are created
72
+ - **Confirm `VERSION` variable** is available
73
+
74
+ ### Phase 3: Gradual Migration (Week 4-6)
75
+
76
+ #### 1. Update Build Jobs
77
+ ```yaml
78
+ # Before: Branch-based tagging
79
+ build:
80
+ stage: build
81
+ script:
82
+ - docker build -t myapp:${CI_COMMIT_REF_SLUG} .
83
+
84
+ # After: Version-based tagging
85
+ build:
86
+ stage: build
87
+ script:
88
+ - docker build -t myapp:${VERSION} .
89
+ needs:
90
+ - agileflow
91
+ ```
92
+
93
+ #### 2. Update Deployment Jobs
94
+ ```yaml
95
+ # Before: Environment-specific branches
96
+ deploy-staging:
97
+ stage: deploy
98
+ only:
99
+ - staging
100
+ script:
101
+ - kubectl set image deployment/myapp myapp=myapp:${CI_COMMIT_REF_SLUG}
102
+
103
+ # After: Version-based deployment
104
+ deploy-staging:
105
+ stage: deploy
106
+ script:
107
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
108
+ environment:
109
+ name: staging
110
+ needs:
111
+ - build
112
+ ```
113
+
114
+ #### 3. Update Testing Jobs
115
+ ```yaml
116
+ # Before: Test against source code
117
+ test:
118
+ stage: test
119
+ script:
120
+ - npm test
121
+
122
+ # After: Test against deployed version
123
+ test:
124
+ stage: test
125
+ script:
126
+ - ./run-tests.sh --version ${VERSION}
127
+ needs:
128
+ - deploy-staging
129
+ ```
130
+
131
+ ### Phase 4: Cleanup (Week 7-8)
132
+
133
+ #### 1. Remove Old Branch Logic
134
+ ```yaml
135
+ # Remove these from your pipeline
136
+ only:
137
+ - staging
138
+ - production
139
+ except:
140
+ - main
141
+ ```
142
+
143
+ #### 2. Clean Up Environment Branches
144
+ ```bash
145
+ # Delete old environment branches
146
+ git branch -d staging
147
+ git branch -d production
148
+
149
+ # Push deletion to remote
150
+ git push origin --delete staging
151
+ git push origin --delete production
152
+ ```
153
+
154
+ #### 3. Update Documentation
155
+ - **Update deployment runbooks** to reference versions
156
+ - **Modify rollback procedures** to use version tags
157
+ - **Update team workflows** and processes
158
+ - **Document new practices** and conventions
159
+
160
+ ## Common Migration Patterns
161
+
162
+ ### Pattern 1: Simple Web Application
163
+
164
+ #### Before (Traditional)
165
+ ```yaml
166
+ stages:
167
+ - build
168
+ - test
169
+ - deploy-staging
170
+ - deploy-production
171
+
172
+ build:
173
+ stage: build
174
+ script:
175
+ - docker build -t myapp:${CI_COMMIT_REF_SLUG} .
176
+
177
+ deploy-staging:
178
+ stage: deploy-staging
179
+ only:
180
+ - staging
181
+ script:
182
+ - kubectl set image deployment/myapp myapp=myapp:${CI_COMMIT_REF_SLUG}
183
+
184
+ deploy-production:
185
+ stage: deploy-production
186
+ only:
187
+ - production
188
+ script:
189
+ - kubectl set image deployment/myapp myapp=myapp:${CI_COMMIT_REF_SLUG}
190
+ ```
191
+
192
+ #### After (AgileFlow)
193
+ ```yaml
194
+ include:
195
+ - local: templates/AgileFlow.gitlab-ci.yml
196
+
197
+ stages:
198
+ - version
199
+ - build
200
+ - deploy
201
+ - test
202
+ - clean
203
+
204
+ build:
205
+ stage: build
206
+ script:
207
+ - docker build -t myapp:${VERSION} .
208
+ needs:
209
+ - agileflow
210
+
211
+ deploy-staging:
212
+ stage: deploy
213
+ script:
214
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
215
+ environment:
216
+ name: staging
217
+ needs:
218
+ - build
219
+
220
+ deploy-production:
221
+ stage: deploy
222
+ script:
223
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
224
+ environment:
225
+ name: production
226
+ when: manual
227
+ needs:
228
+ - build
229
+ ```
230
+
231
+ ### Pattern 2: Microservices Architecture
232
+
233
+ #### Before (Traditional)
234
+ ```yaml
235
+ build-backend:
236
+ stage: build
237
+ script:
238
+ - docker build -t backend:${CI_COMMIT_REF_SLUG} ./backend
239
+
240
+ build-frontend:
241
+ stage: build
242
+ script:
243
+ - docker build -t frontend:${CI_COMMIT_REF_SLUG} ./frontend
244
+
245
+ deploy-staging:
246
+ stage: deploy
247
+ only:
248
+ - staging
249
+ script:
250
+ - kubectl set image deployment/backend backend=backend:${CI_COMMIT_REF_SLUG}
251
+ - kubectl set image deployment/frontend frontend=frontend:${CI_COMMIT_REF_SLUG}
252
+ ```
253
+
254
+ #### After (AgileFlow)
255
+ ```yaml
256
+ include:
257
+ - local: templates/AgileFlow.gitlab-ci.yml
258
+
259
+ build-backend:
260
+ stage: build
261
+ script:
262
+ - docker build -t backend:${VERSION} ./backend
263
+ needs:
264
+ - agileflow
265
+
266
+ build-frontend:
267
+ stage: build
268
+ script:
269
+ - docker build -t frontend:${VERSION} ./frontend
270
+ needs:
271
+ - agileflow
272
+
273
+ deploy-staging:
274
+ stage: deploy
275
+ script:
276
+ - kubectl set image deployment/backend backend=backend:${VERSION}
277
+ - kubectl set image deployment/frontend frontend=frontend:${VERSION}
278
+ environment:
279
+ name: staging
280
+ needs:
281
+ - build-backend
282
+ - build-frontend
283
+ ```
284
+
285
+ ## Migration Challenges and Solutions
286
+
287
+ ### Challenge 1: Team Resistance to Conventional Commits
288
+
289
+ **Problem**: Team members are used to informal commit messages.
290
+
291
+ **Solutions**:
292
+ - **Provide templates** and examples
293
+ - **Use commit hooks** to enforce format
294
+ - **Start with simple types** (feat, fix, docs)
295
+ - **Gradually introduce** more complex patterns
296
+
297
+ ### Challenge 2: Existing Environment-Specific Configurations
298
+
299
+ **Problem**: Different environments need different settings.
300
+
301
+ **Solutions**:
302
+ - **Use environment variables** for configuration
303
+ - **Keep deployment scripts identical** across environments
304
+ - **Use Kubernetes ConfigMaps** or similar for environment differences
305
+ - **Implement feature flags** for environment-specific features
306
+
307
+ ### Challenge 3: Complex Deployment Dependencies
308
+
309
+ **Problem**: Some services depend on others being deployed first.
310
+
311
+ **Solutions**:
312
+ - **Use `needs` dependencies** to control job order
313
+ - **Implement health checks** between deployments
314
+ - **Use Kubernetes readiness probes** for dependency management
315
+ - **Consider service mesh** for complex service interactions
316
+
317
+ ### Challenge 4: Rollback Procedures
318
+
319
+ **Problem**: Current rollback procedures are branch-based.
320
+
321
+ **Solutions**:
322
+ - **Update rollback scripts** to use version tags
323
+ - **Implement automated rollback** jobs
324
+ - **Document version-based rollback** procedures
325
+ - **Test rollback processes** regularly
326
+
327
+ ## Testing Your Migration
328
+
329
+ ### 1. Pipeline Validation
330
+ - **Verify all stages** complete successfully
331
+ - **Check version generation** works correctly
332
+ - **Confirm deployments** use the right versions
333
+ - **Test rollback procedures** work as expected
334
+
335
+ ### 2. Environment Validation
336
+ - **Deploy to staging** and verify functionality
337
+ - **Test production deployment** (if applicable)
338
+ - **Verify environment consistency** (same version everywhere)
339
+ - **Test monitoring and alerting** still work
340
+
341
+ ### 3. Team Validation
342
+ - **Confirm team members** understand new workflow
343
+ - **Verify conventional commits** are being used
344
+ - **Test deployment processes** with team members
345
+ - **Gather feedback** and make adjustments
346
+
347
+ ## Rollback Plan
348
+
349
+ ### If Migration Fails
350
+
351
+ 1. **Revert to previous CI/CD configuration**
352
+ 2. **Restore environment branches** if deleted
353
+ 3. **Update documentation** with lessons learned
354
+ 4. **Plan next migration attempt** with improvements
355
+
356
+ ### Partial Rollback
357
+
358
+ 1. **Keep AgileFlow template** but disable version generation
359
+ 2. **Revert specific jobs** that are causing issues
360
+ 3. **Gradually re-enable** features as issues are resolved
361
+ 4. **Maintain version tags** for future use
362
+
363
+ ## Post-Migration Checklist
364
+
365
+ - [ ] **All environments** are running the same version
366
+ - [ ] **Version tags** are being created automatically
367
+ - [ ] **Deployments** use the `${VERSION}` variable
368
+ - [ ] **Rollback procedures** work with version tags
369
+ - [ ] **Team members** are using conventional commits
370
+ - [ ] **Documentation** has been updated
371
+ - [ ] **Monitoring** shows consistent behavior
372
+ - [ ] **Performance** meets or exceeds previous levels
373
+
374
+ ## Getting Help
375
+
376
+ If you encounter issues during migration:
377
+
378
+ 1. **Check the [Troubleshooting Guide](./troubleshooting.md)**
379
+ 2. **Review [Best Practices](./best-practices.md)** for guidance
380
+ 3. **Consult the [Configuration Guide](./configuration.md)** for setup help
381
+ 4. **Open an issue** in the project repository
382
+ 5. **Join community discussions** for support
383
+
384
+ ## Related Documentation
385
+
386
+ - [Getting Started](./getting-started.md) - Quick start guide
387
+ - [Best Practices](./best-practices.md) - Recommended practices
388
+ - [Configuration](./configuration.md) - Environment variables
389
+ - [GitLab CI Template](./gitlab-ci-template.md) - Template reference
390
+ - [Troubleshooting](./troubleshooting.md) - Common issues and solutions