@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,324 @@
1
+ # GitLab CI Template Reference
2
+
3
+ The AgileFlow GitLab CI template provides a streamlined, version-centric CI/CD pipeline that eliminates the complexity of traditional environment-based deployments.
4
+
5
+ ## Overview
6
+
7
+ This template implements a 6-stage pipeline that focuses on version management rather than branch-based environment management. Every deployment, test, and operation is performed on well-identified versions, ensuring consistency and reliability across all environments.
8
+
9
+ ## Template Structure
10
+
11
+ ```yaml
12
+ include:
13
+ - local: templates/AgileFlow.gitlab-ci.yml
14
+ ```
15
+
16
+ ## Pipeline Stages
17
+
18
+ ### 1. Version Stage
19
+ The foundation of the AgileFlow approach. This stage automatically generates semantic versions and comprehensive release notes.
20
+
21
+ **Job**: `agileflow`
22
+ - **Image**: `registry.logickernel.com/kernel/agileflow:0.8.0`
23
+ - **Script**: `agileflow gitlab-ci`
24
+ - **Artifacts**: `VERSION` variable (dotenv report)
25
+
26
+ **What it does**:
27
+ - Analyzes commit history on the main branch
28
+ - Calculates the next semantic version based on conventional commits
29
+ - Generates comprehensive release notes
30
+ - Creates and pushes version tags to the repository
31
+ - Makes the `VERSION` variable available to all subsequent stages
32
+
33
+ **Output**: The `VERSION` variable contains the generated semantic version (e.g., `v1.2.3`)
34
+
35
+ ### 2. Test Stage
36
+ Runs tests against the source code before building artifacts.
37
+
38
+ **Purpose**: Validate that the source code is ready for building and deployment
39
+ **Input**: Source code and `VERSION` variable from the version stage
40
+ **Output**: Test results and validation that the code meets quality standards
41
+
42
+ **Example implementation**:
43
+ ```yaml
44
+ test:
45
+ stage: test
46
+ script:
47
+ - npm test
48
+ - npm run lint
49
+ needs:
50
+ - agileflow
51
+ ```
52
+
53
+ ### 3. Build Stage
54
+ Creates application artifacts and Docker images using the version from the version stage.
55
+
56
+ **Purpose**: Build versioned artifacts that will be deployed across all environments
57
+ **Input**: `VERSION` variable from the version stage
58
+ **Output**: Versioned artifacts (e.g., `app:v1.2.3`, `frontend:v1.2.3`)
59
+
60
+ **Example implementation**:
61
+ ```yaml
62
+ build:
63
+ stage: build
64
+ script:
65
+ - docker build -t myapp:${VERSION} .
66
+ - docker push myapp:${VERSION}
67
+ needs:
68
+ - test
69
+ ```
70
+
71
+ ### 4. Deploy Stage
72
+ Deploys the versioned artifacts to various environments.
73
+
74
+ **Purpose**: Deploy the same version to staging, production, and other environments
75
+ **Approach**: All environments receive identical versions, eliminating environment drift
76
+ **Benefits**: Predictable deployments, simplified rollbacks, consistent behavior
77
+
78
+ **Example implementation**:
79
+ ```yaml
80
+ deploy-staging:
81
+ stage: deploy
82
+ script:
83
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
84
+ environment:
85
+ name: staging
86
+ needs:
87
+ - build
88
+
89
+ deploy-production:
90
+ stage: deploy
91
+ script:
92
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
93
+ environment:
94
+ name: production
95
+ when: manual
96
+ needs:
97
+ - build
98
+ ```
99
+
100
+ ### 5. E2E Stage
101
+ Validates the deployed version across all environments.
102
+
103
+ **Purpose**: Run tests against the actual deployed version
104
+ **Scope**: Integration tests, end-to-end tests, performance tests
105
+ **Target**: Tests validate exactly what will run in production
106
+
107
+ **Example implementation**:
108
+ ```yaml
109
+ integration-tests:
110
+ stage: e2e
111
+ script:
112
+ - ./run-tests.sh --version ${VERSION}
113
+ needs:
114
+ - deploy-staging
115
+
116
+ performance-tests:
117
+ stage: e2e
118
+ script:
119
+ - ./run-performance-tests.sh --version ${VERSION}
120
+ needs:
121
+ - deploy-staging
122
+ ```
123
+
124
+ ### 6. Clean Stage
125
+ Cleanup temporary resources and artifacts.
126
+
127
+ **Purpose**: Remove old Docker images, temporary files, and unnecessary artifacts
128
+ **Maintenance**: Keep only necessary version artifacts
129
+ **Optimization**: Reduce storage costs and improve pipeline performance
130
+
131
+ **Example implementation**:
132
+ ```yaml
133
+ cleanup:
134
+ stage: clean
135
+ script:
136
+ - docker image prune -f
137
+ - rm -rf /tmp/build-artifacts
138
+ when: always
139
+ ```
140
+
141
+ ## Key Benefits
142
+
143
+ ### Version Consistency
144
+ - **Single Source of Truth**: All environments run identical versions
145
+ - **No Environment Drift**: Staging and production are always in sync
146
+ - **Predictable Deployments**: Every deployment uses a well-identified version
147
+
148
+ ### Simplified Operations
149
+ - **Clear Version Tracking**: Easy to identify what's running where
150
+ - **Simple Rollbacks**: Rollback to any previous version with confidence
151
+ - **Reduced Complexity**: No need to manage multiple deployment branches
152
+
153
+ ### Enhanced Reliability
154
+ - **Auditable Deployments**: Every deployment is tied to a specific version
155
+ - **Consistent Testing**: Tests validate the exact version that will be deployed
156
+ - **Improved Security**: Version-based deployments provide clear audit trails
157
+
158
+ ## Implementation Examples
159
+
160
+ ### Basic Implementation
161
+ ```yaml
162
+ include:
163
+ - local: templates/AgileFlow.gitlab-ci.yml
164
+
165
+ build:
166
+ stage: build
167
+ script:
168
+ - docker build -t myapp:${VERSION} .
169
+ - docker push myapp:${VERSION}
170
+ needs:
171
+ - agileflow
172
+
173
+ deploy:
174
+ stage: deploy
175
+ script:
176
+ - kubectl set image deployment/myapp myapp=myapp:${VERSION}
177
+ needs:
178
+ - build
179
+ ```
180
+
181
+ ### Advanced Implementation with Multiple Services
182
+ ```yaml
183
+ include:
184
+ - local: templates/AgileFlow.gitlab-ci.yml
185
+
186
+ build-backend:
187
+ stage: build
188
+ script:
189
+ - docker build -t backend:${VERSION} ./backend
190
+ - docker push backend:${VERSION}
191
+ needs:
192
+ - agileflow
193
+
194
+ build-frontend:
195
+ stage: build
196
+ script:
197
+ - docker build -t frontend:${VERSION} ./frontend
198
+ - docker push frontend:${VERSION}
199
+ needs:
200
+ - agileflow
201
+
202
+ deploy-staging:
203
+ stage: deploy
204
+ script:
205
+ - kubectl set image deployment/backend backend=backend:${VERSION}
206
+ - kubectl set image deployment/frontend frontend=frontend:${VERSION}
207
+ environment:
208
+ name: staging
209
+ needs:
210
+ - build-backend
211
+ - build-frontend
212
+
213
+ deploy-production:
214
+ stage: deploy
215
+ script:
216
+ - kubectl set image deployment/backend backend=backend:${VERSION}
217
+ - kubectl set image deployment/frontend frontend=frontend:${VERSION}
218
+ environment:
219
+ name: production
220
+ when: manual
221
+ needs:
222
+ - build-backend
223
+ - build-frontend
224
+ ```
225
+
226
+ ## Best Practices
227
+
228
+ ### 1. Always Use the VERSION Variable
229
+ ```yaml
230
+ # ✅ Good - Uses VERSION from AgileFlow
231
+ - docker build -t myapp:${VERSION} .
232
+
233
+ # ❌ Bad - Hardcoded or branch-based tagging
234
+ - docker build -t myapp:latest .
235
+ - docker build -t myapp:${CI_COMMIT_REF_SLUG} .
236
+ ```
237
+
238
+ ### 2. Proper Stage Dependencies
239
+ ```yaml
240
+ # ✅ Good - Clear dependency chain
241
+ deploy:
242
+ stage: deploy
243
+ needs:
244
+ - build
245
+
246
+ # ❌ Bad - No dependencies specified
247
+ deploy:
248
+ stage: deploy
249
+ ```
250
+
251
+ ### 3. Environment-Specific Deployments
252
+ ```yaml
253
+ # ✅ Good - Same version, different environments
254
+ deploy-staging:
255
+ environment:
256
+ name: staging
257
+
258
+ deploy-production:
259
+ environment:
260
+ name: production
261
+ when: manual
262
+ ```
263
+
264
+ ### 4. Consistent Testing
265
+ ```yaml
266
+ # ✅ Good - Test against deployed version
267
+ test:
268
+ stage: test
269
+ script:
270
+ - ./run-tests.sh --version ${VERSION}
271
+ needs:
272
+ - deploy-staging
273
+ ```
274
+
275
+ ## Troubleshooting
276
+
277
+ ### Common Issues
278
+
279
+ **VERSION variable not available**
280
+ - Ensure the `agileflow` job completed successfully
281
+ - Check that the dotenv artifact is properly configured
282
+ - Verify the job dependencies are set correctly
283
+
284
+ **Build failures in later stages**
285
+ - Check that the `VERSION` variable is being used correctly
286
+ - Ensure all jobs have proper `needs` dependencies
287
+ - Verify the artifact paths and variable names
288
+
289
+ **Deployment inconsistencies**
290
+ - Confirm that all deploy jobs use the same `${VERSION}` variable
291
+ - Check that the same image tags are used across environments
292
+ - Verify that the deployment scripts are identical
293
+
294
+ ### Debug Commands
295
+
296
+ ```yaml
297
+ debug-version:
298
+ stage: build
299
+ script:
300
+ - echo "VERSION: ${VERSION}"
301
+ - echo "CI_COMMIT_REF_NAME: ${CI_COMMIT_REF_NAME}"
302
+ - echo "CI_COMMIT_SHA: ${CI_COMMIT_SHA}"
303
+ needs:
304
+ - agileflow
305
+ ```
306
+
307
+ ## Migration from Traditional CI/CD
308
+
309
+ If you're currently using a traditional branch-based approach:
310
+
311
+ 1. **Include the template**: Add the include statement to your `.gitlab-ci.yml`
312
+ 2. **Update build jobs**: Modify build scripts to use `${VERSION}` instead of branch names
313
+ 3. **Consolidate deployments**: Deploy the same version to all environments
314
+ 4. **Update testing**: Ensure tests run against the deployed version
315
+ 5. **Remove branch logic**: Eliminate environment-specific branch handling
316
+
317
+ ## Support
318
+
319
+ For issues or questions about the GitLab CI template:
320
+
321
+ - Check the [main documentation](../README.md)
322
+ - Review the [version-centric CI/CD approach](./version-centric-cicd.md)
323
+ - Open an issue in the project repository
324
+ - Join community discussions
@@ -0,0 +1,163 @@
1
+ # Installation & Setup Guide
2
+
3
+ This guide covers installing and setting up AgileFlow for different platforms and use cases.
4
+
5
+ ## Prerequisites
6
+
7
+ Before installing AgileFlow, ensure you have:
8
+
9
+ - **Git Repository**: A Git repository with GitLab CI/CD enabled
10
+ - **GitLab Access**: Access to modify `.gitlab-ci.yml` files and CI/CD variables
11
+ - **Basic Knowledge**: Understanding of Git, CI/CD, and Docker concepts
12
+
13
+ ## GitLab CI Installation
14
+
15
+ ### Step 1: Include the AgileFlow Template
16
+
17
+ Add this line to the top of your `.gitlab-ci.yml` file:
18
+
19
+ ```yaml
20
+ include:
21
+ - remote: https://code.logickernel.com/kernel/agileflow/-/raw/main/templates/AgileFlow.gitlab-ci.yml
22
+ ```
23
+
24
+ ### Step 2: Configure the AGILEFLOW_TOKEN
25
+
26
+ AgileFlow needs a GitLab access token to create version tags via the API. Set this in your GitLab project's CI/CD variables:
27
+
28
+ 1. Go to your GitLab project
29
+ 2. Navigate to **Settings > CI/CD**
30
+ 3. Expand **Variables**
31
+ 4. Add the `AGILEFLOW_TOKEN` variable:
32
+
33
+ | Variable | Value | Type | Protect | Mask |
34
+ |----------|-------|------|---------|------|
35
+ | `AGILEFLOW_TOKEN` | Your GitLab API token | Variable | Yes | No |
36
+
37
+ #### Creating the AGILEFLOW_TOKEN
38
+
39
+ You need a GitLab access token with API permissions. You can create either:
40
+
41
+ **Option 1: Project Access Token (Recommended)**
42
+ 1. Go to your project's **Settings > Access Tokens**
43
+ 2. Create a new token with:
44
+ - **Name**: `AgileFlow Bot`
45
+ - **Description**: `Token for AgileFlow automatic versioning`
46
+ - **Role**: `maintainer` or higher
47
+ - **Scopes**: `api`
48
+ 3. Copy the generated token
49
+
50
+ **Option 2: Personal Access Token**
51
+ 1. Go to your user **Settings > Access Tokens**
52
+ 2. Create a new token with:
53
+ - **Name**: `AgileFlow Bot`
54
+ - **Description**: `Token for AgileFlow automatic versioning`
55
+ - **Scopes**: `api`
56
+ 3. Copy the generated token
57
+
58
+ ### Step 3: Add Your First Job
59
+
60
+ Below the include statement, add a simple build job to test the setup:
61
+
62
+ ```yaml
63
+ build:
64
+ stage: build
65
+ script:
66
+ - echo "Building version ${VERSION}"
67
+ - docker build -t myapp:${VERSION} .
68
+ - docker push myapp:${VERSION}
69
+ needs:
70
+ - agileflow
71
+ ```
72
+
73
+ ### Step 4: Test the Installation
74
+
75
+ 1. Commit and push your changes:
76
+ ```bash
77
+ git add .gitlab-ci.yml
78
+ git commit -m "feat: add AgileFlow CI/CD pipeline"
79
+ git push
80
+ ```
81
+
82
+ 2. Check your GitLab CI pipeline - it should automatically start
83
+ 3. The `agileflow` job should complete successfully and generate a version
84
+ 4. Subsequent jobs should have access to the `${VERSION}` variable
85
+
86
+ ## How It Works
87
+
88
+ AgileFlow uses a different approach than traditional CI/CD tools:
89
+
90
+ ### No Git Push Required
91
+ - **AgileFlow does NOT push tags to your repository** using git commands
92
+ - **Instead, it uses the GitLab API** to create tags remotely
93
+ - **This eliminates the need** for job token permissions to push to the repository
94
+
95
+ ### Version Generation Process
96
+ 1. **Analyzes commit history** on the main branch
97
+ 2. **Calculates next semantic version** based on conventional commits
98
+ 3. **Creates version tag** via GitLab API (not git push)
99
+ 4. **Makes VERSION variable available** to all subsequent pipeline stages
100
+
101
+ ### Benefits of This Approach
102
+ - **No repository write permissions** needed for CI/CD jobs
103
+ - **More secure** - uses API tokens instead of git credentials
104
+ - **Works with protected branches** without special permissions
105
+ - **Consistent behavior** across all GitLab instances
106
+
107
+ ## Troubleshooting Installation
108
+
109
+ ### Common Issues
110
+
111
+ #### AGILEFLOW_TOKEN Permission Errors
112
+
113
+ **Problem**: Token permission denied errors.
114
+
115
+ **Solutions**:
116
+ - Ensure the token has `api` scope
117
+ - Verify the token has `maintainer` role or higher
118
+ - Check that the token hasn't expired
119
+ - Confirm the token is for the correct project/user
120
+
121
+ #### Template Include Fails
122
+
123
+ **Problem**: The AgileFlow template include statement fails.
124
+
125
+ **Solutions**:
126
+ - Check network connectivity to `code.logickernel.com`
127
+ - Verify the remote URL is accessible from your GitLab instance
128
+ - Check firewall rules and network policies
129
+ - Use a local copy of the template if remote access is restricted
130
+
131
+ #### VERSION Variable Not Available
132
+
133
+ **Problem**: The `${VERSION}` variable is not available in subsequent pipeline stages.
134
+
135
+ **Solutions**:
136
+ - Ensure the `agileflow` job completed successfully
137
+ - Check that your jobs have `needs: - agileflow` dependency
138
+ - Verify the dotenv artifact is properly configured
139
+ - Check the `agileflow` job logs for errors
140
+
141
+ ### Debug Configuration
142
+
143
+ Add a debug job to verify the setup:
144
+
145
+ ```yaml
146
+ debug-version:
147
+ stage: build
148
+ script:
149
+ - echo "VERSION: ${VERSION}"
150
+ - echo "CI_COMMIT_REF_NAME: ${CI_COMMIT_REF_NAME}"
151
+ - echo "CI_COMMIT_SHA: ${CI_COMMIT_SHA}"
152
+ needs:
153
+ - agileflow
154
+ ```
155
+
156
+ ## Next Steps
157
+
158
+ After successful installation:
159
+
160
+ 1. **Read the [Getting Started Guide](./getting-started.md)** for your first pipeline
161
+ 2. **Explore [Conventional Commits](./conventional-commits.md)** for proper commit formatting
162
+ 3. **Review [GitLab CI Template Reference](./gitlab-ci-template.md)** for advanced configuration
163
+ 4. **Check [Troubleshooting](./troubleshooting.md)** if you encounter issues