@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.
- package/README.md +289 -0
- package/bin/agileflow +4 -0
- package/docs/README.md +46 -0
- package/docs/best-practices.md +339 -0
- package/docs/branching-strategy.md +448 -0
- package/docs/cli-reference.md +110 -0
- package/docs/configuration.md +232 -0
- package/docs/conventional-commits/type-build.md +23 -0
- package/docs/conventional-commits/type-chore.md +24 -0
- package/docs/conventional-commits/type-ci.md +23 -0
- package/docs/conventional-commits/type-docs.md +23 -0
- package/docs/conventional-commits/type-feat.md +28 -0
- package/docs/conventional-commits/type-fix.md +27 -0
- package/docs/conventional-commits/type-perf.md +24 -0
- package/docs/conventional-commits/type-refactor.md +24 -0
- package/docs/conventional-commits/type-revert.md +16 -0
- package/docs/conventional-commits/type-style.md +24 -0
- package/docs/conventional-commits/type-test.md +24 -0
- package/docs/conventional-commits.md +234 -0
- package/docs/getting-started.md +209 -0
- package/docs/gitlab-ci-template.md +324 -0
- package/docs/installation.md +163 -0
- package/docs/migration-guide.md +390 -0
- package/docs/release-management.md +498 -0
- package/docs/troubleshooting.md +341 -0
- package/docs/version-centric-cicd.md +166 -0
- package/package.json +39 -0
- package/src/git-utils.js +57 -0
- package/src/index.js +88 -0
- package/src/local.js +17 -0
- package/src/utils.js +376 -0
- package/templates/agileflow-tagged.gitlab-ci.yml +66 -0
- package/templates/agileflow.gitlab-ci.yml +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# AgileFlow
|
|
4
|
+
|
|
5
|
+
In today's fast-paced software development landscape, maintaining clarity, consistency, and efficiency in the release process is essential. AgileFlow is a streamlined yet powerful versioning system, branching strategy, and CI/CD tool designed for software teams of all sizes and projects of any scale.
|
|
6
|
+
|
|
7
|
+
AgileFlow enforces Semantic Versioning and integrates a robust branching strategy for development and deployment. It seamlessly works with GitLab CI pipelines to ensure a structured, efficient, and predictable development lifecycle. **All versions are calculated from the main branch's commit history**, ensuring consistent versioning and release notes. Whether for small projects or large-scale deployments, AgileFlow is an indispensable tool that simplifies versioning and release management.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
AgileFlow works integrated with the CI/CD engine to **automatically create a new version** every time there's a merge into the main branch, incrementing the patch number based on the latest identifiable version in the repository.
|
|
12
|
+
|
|
13
|
+
# Installation
|
|
14
|
+
|
|
15
|
+
## GitLab CI
|
|
16
|
+
|
|
17
|
+
AgileFlow integrates with GitLab CI to automate version tagging. Add the following line at the top of `.gitlab-ci.yml`:
|
|
18
|
+
|
|
19
|
+
```yml
|
|
20
|
+
include:
|
|
21
|
+
- remote: https://code.logickernel.com/kernel/agileflow/-/raw/main/templates/AgileFlow.gitlab-ci.yml
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Introducing a simple workflow in which an environment variable $VERSION is available.
|
|
25
|
+
|
|
26
|
+
**Learn More**: [Complete Installation Guide](./docs/installation.md) - Step-by-step setup for different platforms
|
|
27
|
+
|
|
28
|
+
> [!NOTE]
|
|
29
|
+
> AgileFlow uses the GitLab API to create version tags remotely, eliminating the need for repository write permissions. You'll need to configure the `AGILEFLOW_TOKEN` environment variable with API access. See the [Installation Guide](./docs/installation.md) for complete setup instructions.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Core Principles
|
|
33
|
+
|
|
34
|
+
## Main Branch Strategy
|
|
35
|
+
|
|
36
|
+
The main branch is the core of the AgileFlow framework. It serves as the single source of truth for all releases and versioning.
|
|
37
|
+
|
|
38
|
+
**Key Benefits:**
|
|
39
|
+
- **Single Version Sequence**: All versions (v1.0.0, v1.0.1, v1.1.0, etc.) are created from the same branch
|
|
40
|
+
- **Simplified Workflow**: No need to manage multiple release branches
|
|
41
|
+
- **Consistent History**: All releases share the same commit history and lineage
|
|
42
|
+
- **Easy Rollbacks**: Simple to revert to any previous version since all versions are on the same branch
|
|
43
|
+
|
|
44
|
+
**Version Management:**
|
|
45
|
+
- Patch versions (v1.0.0 → v1.0.1) are automatically incremented on each merge to main
|
|
46
|
+
- Minor versions (v1.0.0 → v1.1.0) are created by merging significant features
|
|
47
|
+
- Major versions (v1.0.0 → v2.0.0) are created for breaking changes
|
|
48
|
+
|
|
49
|
+
**Learn More**: [Branching Strategy Guide](./docs/branching-strategy.md) - Complete guide to AgileFlow's branching approach
|
|
50
|
+
|
|
51
|
+
## Development Branches
|
|
52
|
+
|
|
53
|
+
Development branches are used for feature additions and bug fixes. They branch off the main branch and merge back into it when ready. Consider using expressive names depending on their purpose, e.g.: `dev/*`, `feat/*`, `fix/*`, and `hotfix/*`.
|
|
54
|
+
|
|
55
|
+
After the contribution is ready, the development branch is merged into main, preferably using a [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) a [Merge Request](https://docs.gitlab.com/ee/user/project/merge_requests/) or similar.
|
|
56
|
+
|
|
57
|
+
**Learn More**: [Getting Started Guide](./docs/getting-started.md) - Quick start for new AgileFlow users
|
|
58
|
+
|
|
59
|
+
# Version-Centric CI/CD Approach
|
|
60
|
+
|
|
61
|
+
AgileFlow introduces a revolutionary approach to CI/CD that prioritizes **version management over environment-based deployments**. This paradigm shift eliminates the complexity of managing multiple deployment branches and environments, replacing them with a streamlined, version-focused workflow.
|
|
62
|
+
|
|
63
|
+
## What Makes AgileFlow Different?
|
|
64
|
+
|
|
65
|
+
- **Version-Centric**: Every deployment, test, and operation is performed on well-identified versions
|
|
66
|
+
- **Simplified Pipeline**: Just 6 focused stages (version, test, build, deploy, e2e, clean)
|
|
67
|
+
- **Eliminates Environment Drift**: All environments run identical versions
|
|
68
|
+
- **Predictable Deployments**: Every deployment uses a well-identified, immutable version
|
|
69
|
+
- **Simple Rollbacks**: Rollback to any previous version with confidence
|
|
70
|
+
|
|
71
|
+
## Pipeline Stages
|
|
72
|
+
|
|
73
|
+
Your pipeline consists of 6 focused stages that work together seamlessly:
|
|
74
|
+
|
|
75
|
+
1. **Version** - AgileFlow generates semantic versions automatically
|
|
76
|
+
2. **Test** - Run tests against the source code before building
|
|
77
|
+
3. **Build** - Create versioned artifacts using the generated version
|
|
78
|
+
4. **Deploy** - Deploy the same version everywhere (staging, production, etc.)
|
|
79
|
+
5. **E2E** - Run end-to-end tests against the deployed version
|
|
80
|
+
6. **Clean** - Cleanup temporary resources and artifacts
|
|
81
|
+
|
|
82
|
+
**Learn More**: [Version-Centric CI/CD Deep Dive](./docs/version-centric-cicd.md) - Comprehensive guide to AgileFlow's revolutionary CI/CD paradigm
|
|
83
|
+
|
|
84
|
+
# Conventional Commits
|
|
85
|
+
|
|
86
|
+
Conventional Commits encode the intent of a change in the commit subject so that humans (and tools) can generate clear release notes and version bumps.
|
|
87
|
+
|
|
88
|
+
## Commit Format
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
type[!]?(scope)?: description
|
|
92
|
+
|
|
93
|
+
[optional body]
|
|
94
|
+
|
|
95
|
+
[optional footer(s)]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Key Commit Types
|
|
99
|
+
|
|
100
|
+
- **feat** - New features (minor version bump)
|
|
101
|
+
- **fix** - Bug fixes (patch version bump)
|
|
102
|
+
- **perf** - Performance improvements (patch version bump)
|
|
103
|
+
- **refactor** - Code refactoring (patch version bump)
|
|
104
|
+
- **build** - Build system changes (patch version bump)
|
|
105
|
+
- **ci** - CI/CD changes (patch version bump)
|
|
106
|
+
- **revert** - Revert previous commits (patch version bump)
|
|
107
|
+
- **docs** - Documentation updates (no version bump)
|
|
108
|
+
- **test** - Test additions/changes (patch version bump)
|
|
109
|
+
- **style** - Code style changes (no version bump)
|
|
110
|
+
- **chore** - Maintenance tasks (no version bump)
|
|
111
|
+
- **!** - Breaking changes (major version bump)
|
|
112
|
+
|
|
113
|
+
## Example Commits
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
feat(auth): add OIDC login flow
|
|
117
|
+
fix(api): correct null handling in user lookup
|
|
118
|
+
perf(cache)!: switch to Redis cluster
|
|
119
|
+
docs: update README with usage examples
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Learn More**: [Conventional Commits Guide](./docs/conventional-commits.md) - Complete guide to commit message formatting and types
|
|
123
|
+
|
|
124
|
+
# Release Management
|
|
125
|
+
|
|
126
|
+
## Automatic Version Generation
|
|
127
|
+
|
|
128
|
+
AgileFlow automatically analyzes your commit history and determines the next semantic version based on conventional commits. Each merge to main triggers a new version:
|
|
129
|
+
|
|
130
|
+
- **Patch versions** (v1.0.0 → v1.0.1) for bug fixes, performance improvements, build changes, CI changes, refactors, reverts, and tests
|
|
131
|
+
- **Minor versions** (v1.0.0 → v1.1.0) for new features
|
|
132
|
+
- **Major versions** (v1.0.0 → v2.0.0) for breaking changes
|
|
133
|
+
|
|
134
|
+
## Initial Versioning (0.x.x)
|
|
135
|
+
|
|
136
|
+
When you first start using AgileFlow, the system begins at **v0.0.0** and automatically increments versions based on your commits:
|
|
137
|
+
|
|
138
|
+
- **Patch versions** (v0.0.0 → v0.0.1) for features, bug fixes, and other changes
|
|
139
|
+
- **Minor versions** (v0.0.0 → v0.1.0) for breaking changes
|
|
140
|
+
|
|
141
|
+
This allows you to develop and iterate while AgileFlow tracks your progress automatically.
|
|
142
|
+
|
|
143
|
+
## Version 1.0.0 - Your First Stable Release
|
|
144
|
+
|
|
145
|
+
**Version 1.0.0 is a significant milestone** that represents your first stable, production-ready release. This version should be **created manually** when your team decides the software is ready for its first stable release.
|
|
146
|
+
|
|
147
|
+
To create version 1.0.0:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Create the tag manually
|
|
151
|
+
git tag -a v1.0.0 -m "First stable release"
|
|
152
|
+
|
|
153
|
+
# Push the tag to remote
|
|
154
|
+
git push origin v1.0.0
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
After v1.0.0 is created, AgileFlow will continue to automatically generate subsequent versions (v1.0.1, v1.1.0, v2.0.0, etc.) based on your commit history.
|
|
158
|
+
|
|
159
|
+
> [!NOTE]
|
|
160
|
+
> The transition to 1.0.0 is a deliberate decision that should be made by your team when you're ready to declare API stability and production readiness. AgileFlow will not automatically create 1.0.0 from 0.x.x versions.
|
|
161
|
+
|
|
162
|
+
## Release Notes
|
|
163
|
+
|
|
164
|
+
AgileFlow generates comprehensive release notes by grouping changes according to their intent:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
v1.2.4
|
|
168
|
+
|
|
169
|
+
Features:
|
|
170
|
+
- auth: add OIDC login flow
|
|
171
|
+
|
|
172
|
+
Bug fixes:
|
|
173
|
+
- api: correct null handling in user lookup
|
|
174
|
+
|
|
175
|
+
Performance improvements:
|
|
176
|
+
- cache: optimize Redis connection pooling
|
|
177
|
+
|
|
178
|
+
Build system:
|
|
179
|
+
- update webpack to v5
|
|
180
|
+
- upgrade React to 18.2.0
|
|
181
|
+
|
|
182
|
+
CI:
|
|
183
|
+
- fix pipeline configuration
|
|
184
|
+
|
|
185
|
+
Refactors:
|
|
186
|
+
- simplify authentication logic
|
|
187
|
+
|
|
188
|
+
Tests:
|
|
189
|
+
- add integration tests for auth flow
|
|
190
|
+
- increase test coverage to 85%
|
|
191
|
+
|
|
192
|
+
Reverts:
|
|
193
|
+
- "feat: add experimental feature"
|
|
194
|
+
|
|
195
|
+
Documentation:
|
|
196
|
+
- update README with usage examples
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Learn More**: [Release Management Guide](./docs/release-management.md) - How to manage releases and versions effectively
|
|
200
|
+
|
|
201
|
+
# GitLab CI Integration
|
|
202
|
+
|
|
203
|
+
## Template Usage
|
|
204
|
+
|
|
205
|
+
Include the AgileFlow template in your `.gitlab-ci.yml`:
|
|
206
|
+
|
|
207
|
+
```yaml
|
|
208
|
+
include:
|
|
209
|
+
- local: templates/AgileFlow.gitlab-ci.yml
|
|
210
|
+
|
|
211
|
+
# Your custom jobs using the VERSION variable
|
|
212
|
+
build:
|
|
213
|
+
stage: build
|
|
214
|
+
script:
|
|
215
|
+
- docker build -t myapp:${VERSION} .
|
|
216
|
+
- docker push myapp:${VERSION}
|
|
217
|
+
needs:
|
|
218
|
+
- agileflow
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
> [!NOTE]
|
|
222
|
+
> If you prefer to use the remote template, you can use:
|
|
223
|
+
> ```yaml
|
|
224
|
+
> include:
|
|
225
|
+
> - remote: https://code.logickernel.com/kernel/agileflow/-/raw/main/templates/AgileFlow.gitlab-ci.yml
|
|
226
|
+
> ```
|
|
227
|
+
|
|
228
|
+
## Key Benefits
|
|
229
|
+
|
|
230
|
+
- **Automated Versioning**: The `agileflow` job generates versions automatically
|
|
231
|
+
- **VERSION Variable**: Available to all subsequent stages
|
|
232
|
+
- **Consistent Deployments**: Deploy the same version everywhere
|
|
233
|
+
- **Simplified Rollbacks**: Rollback to any previous version with confidence
|
|
234
|
+
|
|
235
|
+
**Learn More**: [GitLab CI Template Reference](./docs/gitlab-ci-template.md) - Complete reference for the AgileFlow GitLab CI template
|
|
236
|
+
|
|
237
|
+
# Getting Started
|
|
238
|
+
|
|
239
|
+
## Quick Setup (5 minutes)
|
|
240
|
+
|
|
241
|
+
1. **Include the template** in your `.gitlab-ci.yml`
|
|
242
|
+
2. **Add your first job** using the `${VERSION}` variable
|
|
243
|
+
3. **Commit and push** - AgileFlow automatically generates versions
|
|
244
|
+
|
|
245
|
+
## Next Steps
|
|
246
|
+
|
|
247
|
+
- Add deployment jobs for staging and production
|
|
248
|
+
- Implement testing against deployed versions
|
|
249
|
+
- Customize for multiple services
|
|
250
|
+
- Set up environment-specific configurations
|
|
251
|
+
|
|
252
|
+
**Learn More**: [Getting Started Guide](./docs/getting-started.md) - Step-by-step setup and examples
|
|
253
|
+
|
|
254
|
+
# Advanced Topics
|
|
255
|
+
|
|
256
|
+
## Migration from Traditional CI/CD
|
|
257
|
+
|
|
258
|
+
If you're currently using a traditional branch-based approach:
|
|
259
|
+
|
|
260
|
+
1. **Start with AgileFlow** - Include the template and let it generate versions
|
|
261
|
+
2. **Gradually simplify** - Remove environment-specific branches over time
|
|
262
|
+
3. **Update deployments** - Modify scripts to use `${VERSION}` variable
|
|
263
|
+
4. **Standardize testing** - Run tests against the deployed version
|
|
264
|
+
5. **Document changes** - Update runbooks to reference versions
|
|
265
|
+
|
|
266
|
+
## Best Practices
|
|
267
|
+
|
|
268
|
+
- Always use the `${VERSION}` variable from AgileFlow
|
|
269
|
+
- Deploy the same version to all environments
|
|
270
|
+
- Test against deployed versions, not source code
|
|
271
|
+
- Use conventional commits for automatic versioning
|
|
272
|
+
- Keep deployment scripts identical across environments
|
|
273
|
+
|
|
274
|
+
**Learn More**: [Advanced Topics](./docs/README.md#advanced-topics) - Migration guides, best practices, and troubleshooting
|
|
275
|
+
|
|
276
|
+
# Documentation
|
|
277
|
+
|
|
278
|
+
For comprehensive guides and detailed explanations, see our [documentation folder](./docs/README.md).
|
|
279
|
+
|
|
280
|
+
## Quick Navigation
|
|
281
|
+
|
|
282
|
+
- **New to AgileFlow?** Start with [Getting Started](./docs/getting-started.md)
|
|
283
|
+
- **Want to understand the approach?** Read [Version-Centric CI/CD](./docs/version-centric-cicd.md)
|
|
284
|
+
- **Ready to implement?** Follow [GitLab CI Template Reference](./docs/gitlab-ci-template.md)
|
|
285
|
+
- **Need help?** Check [Troubleshooting](./docs/troubleshooting.md)
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
**Ready to transform your CI/CD?** Start with AgileFlow today and experience the benefits of a version-centric, streamlined deployment process! 🚀
|
package/bin/agileflow
ADDED
package/docs/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# AgileFlow Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the AgileFlow documentation! This folder contains detailed guides and explanations for different aspects of the AgileFlow system.
|
|
4
|
+
|
|
5
|
+
## Quick Navigation
|
|
6
|
+
|
|
7
|
+
- **New to AgileFlow?** Start with [Getting Started](./getting-started.md)
|
|
8
|
+
- **Want to understand the approach?** Read [Version-Centric CI/CD](./version-centric-cicd.md)
|
|
9
|
+
- **Ready to install?** Follow [Installation & Setup](./installation.md)
|
|
10
|
+
- **Need help?** Check [Troubleshooting](./troubleshooting.md)
|
|
11
|
+
|
|
12
|
+
## Available Documentation
|
|
13
|
+
|
|
14
|
+
### Core Concepts
|
|
15
|
+
- **[Version-Centric CI/CD Approach](./version-centric-cicd.md)** - Comprehensive guide to AgileFlow's revolutionary CI/CD paradigm
|
|
16
|
+
- **[Installation & Setup](./installation.md)** - Step-by-step installation instructions for different platforms
|
|
17
|
+
- **[Conventional Commits](./conventional-commits.md)** - Detailed guide to commit message formatting and types
|
|
18
|
+
|
|
19
|
+
### User Guides
|
|
20
|
+
- **[Getting Started](./getting-started.md)** - Quick start guide for new AgileFlow users
|
|
21
|
+
- **[Branching Strategy](./branching-strategy.md)** - Complete guide to AgileFlow's branching approach
|
|
22
|
+
- **[Release Management](./release-management.md)** - How to manage releases and versions effectively
|
|
23
|
+
|
|
24
|
+
### Reference
|
|
25
|
+
- **[GitLab CI Template](./gitlab-ci-template.md)** - Complete reference for the AgileFlow GitLab CI template
|
|
26
|
+
- **[CLI Reference](./cli-reference.md)** - Command-line interface documentation
|
|
27
|
+
- **[Configuration](./configuration.md)** - Configuration options and environment variables
|
|
28
|
+
|
|
29
|
+
### Advanced Topics
|
|
30
|
+
- **[Migration Guide](./migration-guide.md)** - How to transition from traditional CI/CD approaches
|
|
31
|
+
- **[Best Practices](./best-practices.md)** - Recommended practices and patterns
|
|
32
|
+
- **[Troubleshooting](./troubleshooting.md)** - Common issues and solutions
|
|
33
|
+
|
|
34
|
+
## Contributing to Documentation
|
|
35
|
+
|
|
36
|
+
We welcome contributions to improve our documentation! Please:
|
|
37
|
+
|
|
38
|
+
1. Follow the existing style and tone
|
|
39
|
+
2. Use clear, concise language
|
|
40
|
+
3. Include practical examples where helpful
|
|
41
|
+
4. Test any code examples or commands
|
|
42
|
+
5. Submit changes via merge requests
|
|
43
|
+
|
|
44
|
+
## External Resources
|
|
45
|
+
|
|
46
|
+
- [Main README](../README.md) - Project overview and quick start
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Best Practices Guide
|
|
2
|
+
|
|
3
|
+
This guide provides recommended practices and patterns for using AgileFlow effectively in your development workflow.
|
|
4
|
+
|
|
5
|
+
## Commit Message Best Practices
|
|
6
|
+
|
|
7
|
+
### 1. Use Conventional Commits Consistently
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# ✅ Good - Clear and consistent
|
|
11
|
+
feat(auth): add OAuth2 login support
|
|
12
|
+
fix(api): handle null user ID gracefully
|
|
13
|
+
docs: update installation guide
|
|
14
|
+
|
|
15
|
+
# ❌ Bad - Inconsistent and unclear
|
|
16
|
+
add oauth
|
|
17
|
+
fix bug
|
|
18
|
+
update docs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Add Scopes for Better Organization
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# ✅ Good - Scoped commits
|
|
25
|
+
feat(auth): implement JWT token validation
|
|
26
|
+
fix(api): resolve user lookup timeout
|
|
27
|
+
docs(readme): add troubleshooting section
|
|
28
|
+
|
|
29
|
+
# ❌ Bad - No scope
|
|
30
|
+
feat: implement JWT token validation
|
|
31
|
+
fix: resolve user lookup timeout
|
|
32
|
+
docs: add troubleshooting section
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. Write Clear, Descriptive Messages
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# ✅ Good - Clear description
|
|
39
|
+
feat(auth): add two-factor authentication with SMS
|
|
40
|
+
fix(api): handle database connection failures gracefully
|
|
41
|
+
docs: add comprehensive API reference
|
|
42
|
+
|
|
43
|
+
# ❌ Bad - Vague description
|
|
44
|
+
feat: add 2FA
|
|
45
|
+
fix: fix bug
|
|
46
|
+
docs: update docs
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 4. Use Breaking Change Indicators Properly
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# ✅ Good - Breaking changes clearly marked
|
|
53
|
+
feat!: remove deprecated API endpoints
|
|
54
|
+
feat(auth)!: change user ID format to UUID
|
|
55
|
+
BREAKING CHANGE: modify database schema
|
|
56
|
+
|
|
57
|
+
# ❌ Bad - Breaking changes not marked
|
|
58
|
+
feat: remove deprecated API endpoints
|
|
59
|
+
feat(auth): change user ID format to UUID
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Pipeline Configuration Best Practices
|
|
63
|
+
|
|
64
|
+
### 1. Always Use the VERSION Variable
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
# ✅ Good - Uses VERSION from AgileFlow
|
|
68
|
+
build:
|
|
69
|
+
stage: build
|
|
70
|
+
script:
|
|
71
|
+
- docker build -t myapp:${VERSION} .
|
|
72
|
+
- docker push myapp:${VERSION}
|
|
73
|
+
|
|
74
|
+
# ❌ Bad - Hardcoded or branch-based tagging
|
|
75
|
+
build:
|
|
76
|
+
stage: build
|
|
77
|
+
script:
|
|
78
|
+
- docker build -t myapp:latest .
|
|
79
|
+
- docker build -t myapp:${CI_COMMIT_REF_SLUG} .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Proper Stage Dependencies
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# ✅ Good - Clear dependency chain
|
|
86
|
+
deploy:
|
|
87
|
+
stage: deploy
|
|
88
|
+
needs:
|
|
89
|
+
- build
|
|
90
|
+
|
|
91
|
+
# ❌ Bad - No dependencies specified
|
|
92
|
+
deploy:
|
|
93
|
+
stage: deploy
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. Environment-Specific Deployments
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
# ✅ Good - Same version, different environments
|
|
100
|
+
deploy-staging:
|
|
101
|
+
environment:
|
|
102
|
+
name: staging
|
|
103
|
+
|
|
104
|
+
deploy-production:
|
|
105
|
+
environment:
|
|
106
|
+
name: production
|
|
107
|
+
when: manual
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 4. Consistent Testing
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
# ✅ Good - Test against deployed version
|
|
114
|
+
test:
|
|
115
|
+
stage: test
|
|
116
|
+
script:
|
|
117
|
+
- ./run-tests.sh --version ${VERSION}
|
|
118
|
+
needs:
|
|
119
|
+
- deploy-staging
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Version Management Best Practices
|
|
123
|
+
|
|
124
|
+
### 1. Keep Releases Small and Focused
|
|
125
|
+
|
|
126
|
+
- **Small releases** reduce risk and make debugging easier
|
|
127
|
+
- **Frequent releases** provide faster feedback
|
|
128
|
+
- **Focused changes** make rollbacks more predictable
|
|
129
|
+
|
|
130
|
+
### 2. Test Thoroughly Before Merging
|
|
131
|
+
|
|
132
|
+
- **Unit tests** should pass on feature branches
|
|
133
|
+
- **Integration tests** should run before merge
|
|
134
|
+
- **Documentation** should be updated with changes
|
|
135
|
+
|
|
136
|
+
### 3. Use Feature Flags for Large Changes
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
# ✅ Good - Feature flag for gradual rollout
|
|
140
|
+
deploy:
|
|
141
|
+
stage: deploy
|
|
142
|
+
script:
|
|
143
|
+
- kubectl set image deployment/myapp myapp=myapp:${VERSION}
|
|
144
|
+
- kubectl patch deployment/myapp -p '{"spec":{"template":{"metadata":{"annotations":{"feature-flag/new-auth":"enabled"}}}}}'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 4. Monitor Deployments
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
# ✅ Good - Health checks after deployment
|
|
151
|
+
deploy:
|
|
152
|
+
stage: deploy
|
|
153
|
+
script:
|
|
154
|
+
- kubectl set image deployment/myapp myapp=myapp:${VERSION}
|
|
155
|
+
- kubectl rollout status deployment/myapp --timeout=300s
|
|
156
|
+
- ./health-check.sh
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Security Best Practices
|
|
160
|
+
|
|
161
|
+
### 1. Secure Environment Variables
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
# ✅ Good - Protected and masked variables
|
|
165
|
+
variables:
|
|
166
|
+
AGILEFLOW_TOKEN: $AGILEFLOW_TOKEN # Protected and masked
|
|
167
|
+
GITLAB_USER_NAME: "AgileFlow Bot" # Not sensitive
|
|
168
|
+
|
|
169
|
+
# ❌ Bad - Exposed sensitive information
|
|
170
|
+
variables:
|
|
171
|
+
AGILEFLOW_TOKEN: "glpat-xxxxxxxxxxxxxxxxxxxx"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 2. Minimal Token Permissions
|
|
175
|
+
|
|
176
|
+
- **Use project tokens** instead of personal tokens when possible
|
|
177
|
+
- **Limit token scope** to only required permissions
|
|
178
|
+
- **Regular token rotation** for security
|
|
179
|
+
|
|
180
|
+
### 3. Environment Isolation
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
# ✅ Good - Environment-specific configurations
|
|
184
|
+
deploy-staging:
|
|
185
|
+
environment:
|
|
186
|
+
name: staging
|
|
187
|
+
variables:
|
|
188
|
+
DATABASE_URL: $STAGING_DATABASE_URL
|
|
189
|
+
|
|
190
|
+
deploy-production:
|
|
191
|
+
environment:
|
|
192
|
+
name: production
|
|
193
|
+
variables:
|
|
194
|
+
DATABASE_URL: $PRODUCTION_DATABASE_URL
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Performance Best Practices
|
|
198
|
+
|
|
199
|
+
### 1. Optimize Build Times
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
# ✅ Good - Cached dependencies
|
|
203
|
+
build:
|
|
204
|
+
stage: build
|
|
205
|
+
cache:
|
|
206
|
+
key: ${CI_COMMIT_REF_SLUG}
|
|
207
|
+
paths:
|
|
208
|
+
- node_modules/
|
|
209
|
+
- .cache/
|
|
210
|
+
script:
|
|
211
|
+
- npm ci --cache .npm --prefer-offline
|
|
212
|
+
- npm run build
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 2. Parallel Job Execution
|
|
216
|
+
|
|
217
|
+
```yaml
|
|
218
|
+
# ✅ Good - Parallel builds for multiple services
|
|
219
|
+
build-backend:
|
|
220
|
+
stage: build
|
|
221
|
+
script:
|
|
222
|
+
- docker build -t backend:${VERSION} ./backend
|
|
223
|
+
|
|
224
|
+
build-frontend:
|
|
225
|
+
stage: build
|
|
226
|
+
script:
|
|
227
|
+
- docker build -t frontend:${VERSION} ./frontend
|
|
228
|
+
|
|
229
|
+
# Both jobs can run in parallel
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 3. Efficient Artifact Management
|
|
233
|
+
|
|
234
|
+
```yaml
|
|
235
|
+
# ✅ Good - Selective artifacts
|
|
236
|
+
build:
|
|
237
|
+
stage: build
|
|
238
|
+
artifacts:
|
|
239
|
+
paths:
|
|
240
|
+
- dist/
|
|
241
|
+
- build/
|
|
242
|
+
expire_in: 1 week
|
|
243
|
+
when: on_success
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Monitoring and Observability
|
|
247
|
+
|
|
248
|
+
### 1. Pipeline Visibility
|
|
249
|
+
|
|
250
|
+
```yaml
|
|
251
|
+
# ✅ Good - Clear job names and descriptions
|
|
252
|
+
build-production:
|
|
253
|
+
stage: build
|
|
254
|
+
description: "Build production artifacts with version ${VERSION}"
|
|
255
|
+
script:
|
|
256
|
+
- echo "Building version ${VERSION}"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 2. Deployment Tracking
|
|
260
|
+
|
|
261
|
+
```yaml
|
|
262
|
+
# ✅ Good - Track deployment status
|
|
263
|
+
deploy:
|
|
264
|
+
stage: deploy
|
|
265
|
+
script:
|
|
266
|
+
- kubectl set image deployment/myapp myapp=myapp:${VERSION}
|
|
267
|
+
- echo "Deployed ${VERSION} at $(date)" >> deployment.log
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 3. Error Reporting
|
|
271
|
+
|
|
272
|
+
```yaml
|
|
273
|
+
# ✅ Good - Comprehensive error handling
|
|
274
|
+
deploy:
|
|
275
|
+
stage: deploy
|
|
276
|
+
script:
|
|
277
|
+
- |
|
|
278
|
+
if ! kubectl set image deployment/myapp myapp=myapp:${VERSION}; then
|
|
279
|
+
echo "Deployment failed for version ${VERSION}"
|
|
280
|
+
exit 1
|
|
281
|
+
fi
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Migration Best Practices
|
|
285
|
+
|
|
286
|
+
### 1. Gradual Adoption
|
|
287
|
+
|
|
288
|
+
- **Start with AgileFlow** on new projects
|
|
289
|
+
- **Gradually migrate** existing pipelines
|
|
290
|
+
- **Test thoroughly** before full migration
|
|
291
|
+
|
|
292
|
+
### 2. Team Training
|
|
293
|
+
|
|
294
|
+
- **Train team members** on conventional commits
|
|
295
|
+
- **Document workflow changes** clearly
|
|
296
|
+
- **Provide examples** and templates
|
|
297
|
+
|
|
298
|
+
### 3. Rollback Planning
|
|
299
|
+
|
|
300
|
+
```yaml
|
|
301
|
+
# ✅ Good - Rollback capability
|
|
302
|
+
rollback:
|
|
303
|
+
stage: deploy
|
|
304
|
+
script:
|
|
305
|
+
- |
|
|
306
|
+
PREVIOUS_VERSION=$(git describe --abbrev=0 --tags v${VERSION%.*}.$((10#${VERSION##*.} - 1)))
|
|
307
|
+
kubectl set image deployment/myapp myapp=myapp:${PREVIOUS_VERSION}
|
|
308
|
+
when: manual
|
|
309
|
+
allow_failure: true
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Documentation Best Practices
|
|
313
|
+
|
|
314
|
+
### 1. Keep Documentation Updated
|
|
315
|
+
|
|
316
|
+
- **Update README** with new features
|
|
317
|
+
- **Document breaking changes** clearly
|
|
318
|
+
- **Provide examples** for common use cases
|
|
319
|
+
|
|
320
|
+
### 2. Version-Specific Documentation
|
|
321
|
+
|
|
322
|
+
```yaml
|
|
323
|
+
# ✅ Good - Generate version-specific docs
|
|
324
|
+
docs:
|
|
325
|
+
stage: deploy
|
|
326
|
+
script:
|
|
327
|
+
- |
|
|
328
|
+
echo "# Version ${VERSION}" > docs/versions/${VERSION}.md
|
|
329
|
+
echo "Released: $(date)" >> docs/versions/${VERSION}.md
|
|
330
|
+
echo "Changes: $(git tag -l -n99 ${VERSION})" >> docs/versions/${VERSION}.md
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Related Documentation
|
|
334
|
+
|
|
335
|
+
- [Getting Started](./getting-started.md) - Quick start guide
|
|
336
|
+
- [Conventional Commits](./conventional-commits.md) - Commit message format
|
|
337
|
+
- [GitLab CI Template](./gitlab-ci-template.md) - Template configuration
|
|
338
|
+
- [Configuration](./configuration.md) - Environment variables
|
|
339
|
+
- [Troubleshooting](./troubleshooting.md) - Common issues and solutions
|