# AITBC Workspace Strategy Guide ## 🎯 Current Workspace Usage ### In-Repo Workspaces (Current) ``` /opt/aitbc/ ├── python-packages-workspace/ # Created inside repo ├── javascript-packages-workspace/ # Created inside repo ├── security-workspace/ # Created inside repo └── compatibility-workspace/ # Created inside repo ``` ## ✅ Benefits of Outside-Repo Workspaces ### 1. **Clean Repository** - No workspace directories in git status - Cleaner commits and PRs - No .gitignore conflicts ### 2. **Better Isolation** - Each workspace has isolated environment - No cross-contamination between tests - Easier cleanup and reset ### 3. **Resource Management** - Workspaces can use different base directories - Better disk space management - Parallel test execution possible ### 4. **CI/CD Best Practices** - Standard industry practice - GitHub Actions, GitLab CI use this pattern - Container-friendly approach ## 🚀 Recommended Workspace Structure ### Outside-Repo Strategy ```bash # Base workspace directory /var/lib/aitbc-workspaces/ ├── python-packages/ ├── javascript-packages/ ├── security-tests/ ├── integration-tests/ ├── compatibility-tests/ └── temp/ ``` ### Alternative: /opt Structure ```bash /opt/aitbc-workspaces/ ├── python-packages/ ├── javascript-packages/ ├── security/ ├── integration/ └── build-artifacts/ ``` ## 📝 Implementation Examples ### Current (Inside Repo) ```yaml - name: Setup Python Workspace run: | cd /opt/aitbc rm -rf python-packages-workspace mkdir -p python-packages-workspace cd python-packages-workspace git clone http://10.0.3.107:3000/oib/aitbc.git repo ``` ### Improved (Outside Repo) ```yaml - name: Setup Python Workspace run: | # Use dedicated workspace directory WORKSPACE_BASE="/var/lib/aitbc-workspaces/python-packages" rm -rf "$WORKSPACE_BASE" mkdir -p "$WORKSPACE_BASE" cd "$WORKSPACE_BASE" git clone http://10.0.3.107:3000/oib/aitbc.git repo cd repo ``` ### Even Better (With Cleanup) ```yaml - name: Setup Workspace run: | # Clean workspace function cleanup_workspace() { local workspace="$1" rm -rf "$workspace" 2>/dev/null || true mkdir -p "$workspace" } # Setup different workspaces cleanup_workspace "/var/lib/aitbc-workspaces/python" cleanup_workspace "/var/lib/aitbc-workspaces/javascript" cleanup_workspace "/var/lib/aitbc-workspaces/security" ``` ## 🔧 Workspace Management Functions ### Reusable Setup Script ```bash #!/bin/bash # /opt/aitbc/scripts/setup-workspace.sh setup_workspace() { local workspace_type="$1" local workspace_base="/var/lib/aitbc-workspaces" local workspace_dir="$workspace_base/$workspace_type" local repo_url="http://10.0.3.107:3000/oib/aitbc.git" echo "=== Setting up $workspace_type workspace ===" # Cleanup and create rm -rf "$workspace_dir" mkdir -p "$workspace_dir" cd "$workspace_dir" # Clone repository git clone "$repo_url" repo cd repo echo "✅ $workspace_type workspace ready at $workspace_dir/repo" } # Usage examples setup_workspace "python-packages" setup_workspace "javascript-packages" setup_workspace "security-tests" ``` ## 📊 Comparison | Aspect | Inside Repo | Outside Repo | |--------|-------------|--------------| | **Clean Git History** | ❌ Workspaces in status | ✅ Clean status | | **Isolation** | ❌ Shared space | ✅ Isolated | | **Cleanup** | ❌ Complex | ✅ Simple | | **Parallel Tests** | ❌ Conflicts | ✅ Possible | | **Disk Usage** | ❌ In repo size | ✅ Separate | | **Industry Standard** | ❌ Non-standard | ✅ Standard | ## 🎯 Recommendation **Switch to outside-repo workspaces for:** 1. **All CI/CD workflows** 2. **Package testing** (Python, JavaScript, Solidity) 3. **Security scanning** 4. **Integration testing** 5. **Build artifacts** **Keep inside-repo only for:** 1. **Development scripts** 2. **Documentation** 3. **Configuration files** ## 🚀 Next Steps 1. Create `/var/lib/aitbc-workspaces/` directory 2. Update CI workflows to use outside-repo workspaces 3. Add workspace management scripts 4. Update .gitignore to exclude any workspace directories 5. Test with existing workflows This will provide cleaner, more maintainable CI/CD pipelines!