Files
aitbc/docs/WORKSPACE_STRATEGY.md
aitbc1 3a58287b07
Some checks failed
package-tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk python_version:3.13]) (push) Successful in 7s
package-tests / test-python-packages (map[name:aitbc-cli path:. python_version:3.13]) (push) Successful in 4s
package-tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core python_version:3.13]) (push) Successful in 7s
package-tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto python_version:3.13]) (push) Successful in 8s
package-tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk python_version:3.13]) (push) Successful in 9s
package-tests / test-javascript-packages (map[name:aitbc-sdk node_version:24 path:packages/js/aitbc-sdk]) (push) Successful in 9s
security-scanning / audit (push) Failing after 1s
package-tests / cross-language-compatibility (push) Successful in 2s
package-tests / package-integration-tests (push) Successful in 1s
Documentation Validation / validate-docs (push) Successful in 6m7s
feat: implement external workspace strategy for CI/CD
- Create workspace management documentation (WORKSPACE_STRATEGY.md)
- Add workspace manager script (scripts/workspace-manager.sh)
- Update package-tests.yml to use external workspaces
- Move workspaces from /opt/aitbc/* to /var/lib/aitbc-workspaces/*
- Implement cleaner CI/CD with isolated workspaces

Benefits:
- Clean repository status (no workspace directories in git)
- Better isolation between test environments
- Industry standard CI/CD practices
- Easier cleanup and resource management
- Parallel test execution capability

Workspace Structure:
- /var/lib/aitbc-workspaces/python-packages/
- /var/lib/aitbc-workspaces/javascript-packages/
- /var/lib/aitbc-workspaces/security-tests/
- /var/lib/aitbc-workspaces/compatibility-tests/

CI Improvements:
- External workspace creation and cleanup
- Standardized workspace management
- Better error handling and recovery
- Cleaner repository history
2026-03-29 12:15:00 +02:00

4.3 KiB

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

Outside-Repo Strategy

# Base workspace directory
/var/lib/aitbc-workspaces/
├── python-packages/
├── javascript-packages/
├── security-tests/
├── integration-tests/
├── compatibility-tests/
└── temp/

Alternative: /opt Structure

/opt/aitbc-workspaces/
├── python-packages/
├── javascript-packages/
├── security/
├── integration/
└── build-artifacts/

📝 Implementation Examples

Current (Inside Repo)

- 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)

- 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)

- 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

#!/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!