@logickernel/agileflow 0.4.0 → 0.4.2

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.
@@ -1,390 +1,303 @@
1
1
  # Migration Guide
2
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.
3
+ This guide helps you transition to AgileFlow's decoupled, version-centric approach.
4
4
 
5
- ## Understanding the Migration
5
+ ## What You're Changing
6
6
 
7
- ### What You're Moving From
7
+ ### From Traditional Approach
8
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)
9
+ - Version calculation mixed with build/deploy
10
+ - Branch-based deployments
11
+ - Manual version management
12
+ - Environment-specific branches
14
13
 
15
- ### What You're Moving To
14
+ ### To AgileFlow Approach
16
15
 
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)
16
+ - **Decoupled versioning** — AgileFlow only creates tags
17
+ - **Tag-triggered pipelines** Build/deploy on tag events
18
+ - **Automatic versions** Based on conventional commits
19
+ - **Single main branch** All versions from one source
22
20
 
23
- ## Migration Strategy
21
+ ---
24
22
 
25
- ### Phase 1: Preparation (Week 1)
23
+ ## Architecture Overview
26
24
 
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
25
+ ```
26
+ ┌─────────────────┐ ┌─────────────────┐
27
+ │ Merge to main │ │ Tag: v1.2.3 │
28
+ │ │ ──────▶ │ │
29
+ │ Versioning │ │ Release │
30
+ │ workflow │ │ workflow │
31
+ └─────────────────┘ └─────────────────┘
32
+ │ │
33
+ ▼ ▼
34
+ AgileFlow Build/Deploy
35
+ creates tag your pipelines
36
+ ```
32
37
 
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
+ ---
38
39
 
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**
40
+ ## Migration Steps
44
41
 
45
- ### Phase 2: Implementation (Week 2-3)
42
+ ### Phase 1: Preparation
46
43
 
47
- #### 1. Add AgileFlow Template
48
- ```yaml
49
- # .gitlab-ci.yml
50
- include:
51
- - local: templates/AgileFlow.gitlab-ci.yml
44
+ #### Train Your Team
52
45
 
53
- # Keep existing jobs for now
54
- build:
55
- stage: build
56
- script:
57
- - echo "Building from branch ${CI_COMMIT_REF_NAME}"
58
- ```
46
+ - Introduce conventional commits
47
+ - Explain the decoupled approach
48
+ - Share commit message examples
59
49
 
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`
50
+ #### Create Access Token
67
51
 
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
52
+ **GitHub:**
53
+ 1. Settings Developer settings Personal access tokens
54
+ 2. Create token with `contents: write`
55
+ 3. Add as secret `AGILEFLOW_TOKEN`
73
56
 
74
- ### Phase 3: Gradual Migration (Week 4-6)
57
+ **GitLab:**
58
+ 1. Project Settings → Access tokens
59
+ 2. Create token with `api` scope, `Maintainer` role
60
+ 3. Add as variable `AGILEFLOW_TOKEN`
75
61
 
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} .
62
+ ### Phase 2: Add Versioning Workflow
83
63
 
84
- # After: Version-based tagging
85
- build:
86
- stage: build
87
- script:
88
- - docker build -t myapp:${VERSION} .
89
- needs:
90
- - agileflow
91
- ```
64
+ **GitHub Actions** Create `.github/workflows/version.yml`:
92
65
 
93
- #### 2. Update Deployment Jobs
94
66
  ```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
67
+ name: Version
68
+ on:
69
+ push:
70
+ branches: [main]
71
+
72
+ jobs:
73
+ version:
74
+ runs-on: ubuntu-latest
75
+ steps:
76
+ - uses: actions/checkout@v4
77
+ with:
78
+ fetch-depth: 0
79
+
80
+ - uses: actions/setup-node@v4
81
+ with:
82
+ node-version: '20'
83
+
84
+ - name: Create version tag
85
+ env:
86
+ AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
87
+ run: npx @logickernel/agileflow github
112
88
  ```
113
89
 
114
- #### 3. Update Testing Jobs
115
- ```yaml
116
- # Before: Test against source code
117
- test:
118
- stage: test
119
- script:
120
- - npm test
90
+ **GitLab CI** Add to `.gitlab-ci.yml`:
121
91
 
122
- # After: Test against deployed version
123
- test:
124
- stage: test
92
+ ```yaml
93
+ agileflow:
94
+ stage: version
95
+ image: node:20-alpine
125
96
  script:
126
- - ./run-tests.sh --version ${VERSION}
127
- needs:
128
- - deploy-staging
97
+ - npx @logickernel/agileflow gitlab
98
+ rules:
99
+ - if: '$CI_COMMIT_BRANCH == "main"'
129
100
  ```
130
101
 
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
- ```
102
+ ### Phase 3: Add Release Workflow
142
103
 
143
- #### 2. Clean Up Environment Branches
144
- ```bash
145
- # Delete old environment branches
146
- git branch -d staging
147
- git branch -d production
104
+ **GitHub Actions** Create `.github/workflows/release.yml`:
148
105
 
149
- # Push deletion to remote
150
- git push origin --delete staging
151
- git push origin --delete production
106
+ ```yaml
107
+ name: Release
108
+ on:
109
+ push:
110
+ tags:
111
+ - 'v*'
112
+
113
+ jobs:
114
+ build:
115
+ runs-on: ubuntu-latest
116
+ steps:
117
+ - uses: actions/checkout@v4
118
+
119
+ - name: Get version
120
+ run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
121
+
122
+ - name: Build
123
+ run: docker build -t myapp:$VERSION .
124
+
125
+ deploy:
126
+ needs: build
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - name: Deploy
130
+ run: kubectl set image deployment/myapp myapp=myapp:$VERSION
152
131
  ```
153
132
 
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
133
+ **GitLab CI** Add to `.gitlab-ci.yml`:
159
134
 
160
- ## Common Migration Patterns
161
-
162
- ### Pattern 1: Simple Web Application
163
-
164
- #### Before (Traditional)
165
135
  ```yaml
166
- stages:
167
- - build
168
- - test
169
- - deploy-staging
170
- - deploy-production
171
-
172
136
  build:
173
137
  stage: build
174
138
  script:
175
- - docker build -t myapp:${CI_COMMIT_REF_SLUG} .
139
+ - docker build -t myapp:$CI_COMMIT_TAG .
140
+ rules:
141
+ - if: '$CI_COMMIT_TAG =~ /^v/'
176
142
 
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
143
+ deploy:
144
+ stage: deploy
188
145
  script:
189
- - kubectl set image deployment/myapp myapp=myapp:${CI_COMMIT_REF_SLUG}
146
+ - kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_TAG
147
+ rules:
148
+ - if: '$CI_COMMIT_TAG =~ /^v/'
190
149
  ```
191
150
 
192
- #### After (AgileFlow)
193
- ```yaml
194
- include:
195
- - local: templates/AgileFlow.gitlab-ci.yml
151
+ ### Phase 4: Remove Old Logic
196
152
 
197
- stages:
198
- - version
199
- - build
200
- - deploy
201
- - test
202
- - clean
153
+ Once the new workflows are working:
203
154
 
204
- build:
205
- stage: build
206
- script:
207
- - docker build -t myapp:${VERSION} .
208
- needs:
209
- - agileflow
155
+ 1. **Remove version calculation** from existing build pipelines
156
+ 2. **Remove environment branches** (staging, production)
157
+ 3. **Remove branch-based triggers** for deployments
210
158
 
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
159
+ ---
219
160
 
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
161
+ ## Common Migration Patterns
162
+
163
+ ### Simple Application
164
+
165
+ **Before:**
166
+ ```yaml
167
+ # Single workflow doing everything
168
+ on: push to main
169
+ calculate version
170
+ → build
171
+ → deploy
229
172
  ```
230
173
 
231
- ### Pattern 2: Microservices Architecture
174
+ **After:**
175
+ ```yaml
176
+ # Workflow 1: version.yml
177
+ on: push to main
178
+ → AgileFlow creates tag
179
+
180
+ # Workflow 2: release.yml
181
+ on: tag v*
182
+ → build
183
+ → deploy
184
+ ```
185
+
186
+ ### Microservices
232
187
 
233
- #### Before (Traditional)
188
+ **After (same version for all services):**
234
189
  ```yaml
190
+ # release.yml
235
191
  build-backend:
236
- stage: build
237
192
  script:
238
- - docker build -t backend:${CI_COMMIT_REF_SLUG} ./backend
193
+ - docker build -t backend:$VERSION ./backend
239
194
 
240
195
  build-frontend:
241
- stage: build
242
196
  script:
243
- - docker build -t frontend:${CI_COMMIT_REF_SLUG} ./frontend
197
+ - docker build -t frontend:$VERSION ./frontend
244
198
 
245
- deploy-staging:
246
- stage: deploy
247
- only:
248
- - staging
199
+ deploy:
200
+ needs: [build-backend, build-frontend]
249
201
  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}
202
+ - kubectl set image deployment/backend backend=backend:$VERSION
203
+ - kubectl set image deployment/frontend frontend=frontend:$VERSION
252
204
  ```
253
205
 
254
- #### After (AgileFlow)
255
- ```yaml
256
- include:
257
- - local: templates/AgileFlow.gitlab-ci.yml
206
+ ---
258
207
 
259
- build-backend:
260
- stage: build
261
- script:
262
- - docker build -t backend:${VERSION} ./backend
263
- needs:
264
- - agileflow
208
+ ## Migration Challenges
265
209
 
266
- build-frontend:
267
- stage: build
268
- script:
269
- - docker build -t frontend:${VERSION} ./frontend
270
- needs:
271
- - agileflow
210
+ ### Existing Version Logic
272
211
 
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
- ```
212
+ **Challenge:** Current pipeline calculates versions.
284
213
 
285
- ## Migration Challenges and Solutions
214
+ **Solution:** Keep both temporarily, then remove old logic:
215
+ ```yaml
216
+ # Phase 1: Add AgileFlow alongside existing logic
217
+ # Phase 2: Switch release workflow to use tags
218
+ # Phase 3: Remove old version calculation
219
+ ```
286
220
 
287
- ### Challenge 1: Team Resistance to Conventional Commits
221
+ ### Team Learning Conventional Commits
288
222
 
289
- **Problem**: Team members are used to informal commit messages.
223
+ **Challenge:** Team not familiar with format.
290
224
 
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
225
+ **Solutions:**
226
+ - Start with just `feat:` and `fix:`
227
+ - Use commit linting
228
+ - Provide IDE snippets
296
229
 
297
- ### Challenge 2: Existing Environment-Specific Configurations
230
+ ### Existing Environment Branches
298
231
 
299
- **Problem**: Different environments need different settings.
232
+ **Challenge:** Using staging/production branches.
300
233
 
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
234
+ **Solution:** After migration works, delete them:
235
+ ```bash
236
+ git branch -d staging
237
+ git push origin --delete staging
238
+ ```
306
239
 
307
- ### Challenge 3: Complex Deployment Dependencies
240
+ ---
308
241
 
309
- **Problem**: Some services depend on others being deployed first.
242
+ ## Testing Your Migration
310
243
 
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
244
+ ### Verify Version Creation
316
245
 
317
- ### Challenge 4: Rollback Procedures
246
+ ```bash
247
+ # Push a conventional commit
248
+ git commit -m "feat: test feature"
249
+ git push
318
250
 
319
- **Problem**: Current rollback procedures are branch-based.
251
+ # Check for new tag
252
+ git tag --sort=-version:refname | head -1
253
+ ```
320
254
 
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
255
+ ### Verify Release Workflow
326
256
 
327
- ## Testing Your Migration
257
+ - Confirm tag triggers your release workflow
258
+ - Check build uses the tag as version
259
+ - Verify deployment works
328
260
 
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
261
+ ### End-to-End Test
334
262
 
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
263
+ 1. Push conventional commit to main
264
+ 2. AgileFlow creates tag (e.g., v1.2.3)
265
+ 3. Release workflow triggers
266
+ 4. Build creates artifact tagged v1.2.3
267
+ 5. Deployment uses correct version
340
268
 
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
269
+ ---
346
270
 
347
271
  ## Rollback Plan
348
272
 
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
273
+ If migration fails:
355
274
 
356
- ### Partial Rollback
275
+ 1. **Revert workflow changes**
276
+ ```bash
277
+ git revert <workflow-commit>
278
+ ```
357
279
 
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
280
+ 2. **Keep running old pipeline** until issues resolved
362
281
 
363
- ## Post-Migration Checklist
282
+ 3. **Document issues** for next attempt
364
283
 
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
284
+ ---
373
285
 
374
- ## Getting Help
286
+ ## Post-Migration Checklist
375
287
 
376
- If you encounter issues during migration:
288
+ - [ ] Versioning workflow creates tags on merge to main
289
+ - [ ] Release workflow triggers on tag creation
290
+ - [ ] Builds use tag as version
291
+ - [ ] Deployments use correct version
292
+ - [ ] Team uses conventional commits
293
+ - [ ] Old version logic removed
294
+ - [ ] Old environment branches deleted
377
295
 
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
296
+ ---
383
297
 
384
298
  ## Related Documentation
385
299
 
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
300
+ - [Getting Started](./getting-started.md) Quick start
301
+ - [Installation Guide](./installation.md) Setup
302
+ - [Best Practices](./best-practices.md) Recommendations
303
+ - [Troubleshooting](./troubleshooting.md) Common issues