|
1 | | -# Docker Git Testing Bug - Complete Fix Guide |
| 1 | +# Docker Git Testing Guide - Multi-Platform Architecture |
| 2 | + |
| 3 | +## ✅ CURRENT STATUS: Multi-Platform CI Implemented |
| 4 | + |
| 5 | +**Architecture Update**: The project now uses environment-aware Git testing: |
| 6 | + |
| 7 | +- **Local Development**: Uses `DockerGit` for isolation |
| 8 | +- **CI Environment**: Uses `NativeGit` for real platform testing |
| 9 | +- **Platform Coverage**: Linux, macOS, Windows all tested with native Git |
| 10 | + |
| 11 | +## Legacy Docker Git Testing Bug - Historical Reference |
2 | 12 |
|
3 | 13 | ## Bug Symptoms |
4 | 14 |
|
@@ -192,33 +202,57 @@ make test |
192 | 202 |
|
193 | 203 | **Result**: You'll now get errors like `❌ Missing --entrypoint sh for alpine/git:latest (will fail in CI)` locally instead of discovering issues in CI. |
194 | 204 |
|
195 | | -## Files to Update When Fixing |
| 205 | +## Current Architecture Files |
196 | 206 |
|
197 | | -1. `src/test_utils/git.rs` - Docker git utility functions |
198 | | -2. `src/vcs/git.rs` - Git VCS implementation test helpers |
199 | | -3. Any other files using Docker git commands |
| 207 | +1. `src/test_utils/git/mod.rs` - GitOperations trait and exports |
| 208 | +2. `src/test_utils/git/docker.rs` - DockerGit implementation (local development) |
| 209 | +3. `src/test_utils/git/native.rs` - NativeGit implementation (CI testing) |
| 210 | +4. `src/config.rs` - Environment detection via `ZERV_CI` variable |
| 211 | +5. `src/test_utils/mod.rs` - `should_use_native_git()` helper function |
200 | 212 |
|
201 | | -## Testing Verification |
| 213 | +## Current Testing Verification |
202 | 214 |
|
203 | 215 | ```bash |
204 | | -# Local test (now includes strict mode) |
| 216 | +# Local test (uses DockerGit for isolation) |
205 | 217 | make test |
206 | 218 |
|
207 | 219 | # Test validation works |
208 | 220 | cargo test test_docker_validation --lib |
209 | 221 |
|
210 | | -# Check specific git tests |
| 222 | +# Check specific git tests (Docker tests only run on Linux) |
211 | 223 | cargo test git --include-ignored |
212 | 224 |
|
213 | | -# Verify CI will pass (should be consistent now) |
214 | | -git push # Check GitHub Actions |
| 225 | +# Verify multi-platform CI passes |
| 226 | +git push # Check GitHub Actions on Linux, macOS, Windows |
215 | 227 | ``` |
216 | 228 |
|
217 | | -## Why This Bug Repeats |
| 229 | +## Multi-Platform CI Benefits |
| 230 | + |
| 231 | +**Real Platform Testing Achieved**: |
| 232 | + |
| 233 | +- ✅ **Windows CI**: Tests actual Windows Git behavior, CRLF line endings, Windows paths |
| 234 | +- ✅ **macOS CI**: Tests actual macOS Git behavior, case-insensitive filesystem |
| 235 | +- ✅ **Linux CI**: Tests actual Linux Git behavior, permissions |
| 236 | + |
| 237 | +**Local Safety Maintained**: |
| 238 | + |
| 239 | +- ✅ **Docker Isolation**: Protects personal git config during local development |
| 240 | +- ✅ **Environment Detection**: Automatic switching via `ZERV_CI=true` |
| 241 | +- ✅ **Consistent API**: Same `GitOperations` trait for both implementations |
| 242 | + |
| 243 | +## Architecture Evolution |
| 244 | + |
| 245 | +**Problem Solved**: The original Docker CI issues are resolved by using native Git in CI: |
| 246 | + |
| 247 | +1. **No more Docker in CI** - Windows/macOS/Linux CI all use native Git |
| 248 | +2. **Real platform testing** - Catches actual platform-specific issues |
| 249 | +3. **Local isolation maintained** - Docker still used for local development safety |
| 250 | +4. **Consistent behavior** - GitOperations trait ensures same API across implementations |
| 251 | + |
| 252 | +**When to Use This Guide**: |
218 | 253 |
|
219 | | -1. **Local testing masks the issue** - Docker Desktop is more forgiving |
220 | | -2. **The error is subtle** - Commands might partially work locally |
221 | | -3. **CI environment is different** - Only fails in the strict CI environment |
222 | | -4. **Git directory context** - After `git init`, subsequent commands need `--git-dir=.git` in containers |
| 254 | +- Reference for understanding DockerGit implementation details |
| 255 | +- Debugging local Docker-based tests |
| 256 | +- Historical context for architecture decisions |
223 | 257 |
|
224 | | -This bug has occurred multiple times - always refer to this guide when Docker git tests fail in CI but pass locally. |
| 258 | +**Current Best Practice**: Use `get_git_impl()` helper function for environment-aware Git operations instead of direct Docker commands. |
0 commit comments