Some checks failed
API Gateway (Java Spring Boot) / test (17) (push) Failing after 2s
API Gateway (Java Spring Boot) / test (21) (push) Failing after 3s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 3s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 3s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 3s
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 3s
LabFusion CI/CD Pipeline / frontend (push) Failing after 2s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 2s
Frontend (React) / test (16) (push) Failing after 2s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 2s
Frontend (React) / test (18) (push) Failing after 3s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 3s
Frontend (React) / test (20) (push) Failing after 3s
Service Adapters (Python FastAPI) / build (push) Has been skipped
Service Adapters (Python FastAPI) / security (push) Has been skipped
Frontend (React) / build (push) Has been skipped
Frontend (React) / security (push) Has been skipped
Frontend (React) / lighthouse (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 4m52s
Docker Build and Push / security-scan (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2s
Docker Build and Push / deploy-staging (push) Has been skipped
Integration Tests / performance-tests (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
API Docs (Node.js Express) / test (16) (push) Failing after 2s
API Docs (Node.js Express) / test (18) (push) Failing after 2s
API Docs (Node.js Express) / test (20) (push) Failing after 2s
API Docs (Node.js Express) / build (push) Has been skipped
API Docs (Node.js Express) / security (push) Has been skipped
5.1 KiB
5.1 KiB
LabFusion CI/CD Optimization Recommendations
Current State Analysis
What We're Currently Using:
- Full Ubuntu Latest images for all workloads (~2-3GB per container)
- Setup actions that install tools every time (Java, Python, Node.js)
- Generic labels that don't optimize for specific workloads
What Each Pipeline Actually Needs:
Heavy Runner (Java + Python):
- Java: JDK 17, Maven (for API Gateway)
- Python: Python 3.11, pip, pytest, flake8, black, isort, bandit, safety, mypy (for Service Adapters)
- Docker: For building images
Light Runner (Node.js + Frontend):
- Node.js: Node 16/18/20, npm (for API Docs and Frontend)
- Docker: For building images
Docker Runner:
- Docker: Docker-in-Docker capabilities
- Basic tools: curl, git
Security Runner:
- Security tools: Trivy, OWASP ZAP, etc.
- Docker: For scanning images
Optimization Strategy
1. Use Specialized Images
Instead of full Ubuntu latest, use optimized images from Gitea's runner-images:
# Heavy Runner - Java workloads
- "java:docker://docker.gitea.com/runner-images:ubuntu-22.04-java17-maven"
- "heavy:docker://docker.gitea.com/runner-images:ubuntu-22.04-java17-maven"
# Heavy Runner - Python workloads
- "python:docker://docker.gitea.com/runner-images:ubuntu-22.04-python3.11"
# Light Runner - Node.js workloads
- "nodejs:docker://docker.gitea.com/runner-images:ubuntu-22.04-node20"
- "frontend:docker://docker.gitea.com/runner-images:ubuntu-22.04-node20"
# Docker Runner - Docker-in-Docker
- "docker:docker://docker.gitea.com/runner-images:ubuntu-22.04-docker"
# Security Runner - Security tools
- "security:docker://docker.gitea.com/runner-images:ubuntu-22.04-security"
2. Benefits of Specialized Images
- Faster startup: Pre-installed tools mean no setup time
- Smaller images: Only includes what's needed (~500MB vs 2-3GB)
- Better caching: Tools are already in the image layer
- More reliable: No network dependency for tool installation
3. Workflow Optimizations
Remove Redundant Setup Steps
Before (current):
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
After (optimized):
# Remove this step - Java 17 and Maven are pre-installed
# - name: Set up JDK 17
# uses: actions/setup-java@v4
Use Matrix Strategy for Node.js Versions
Current approach: Multiple setup steps Optimized approach: Use matrix with specialized images
strategy:
matrix:
node-version: [16, 18, 20]
image:
- "ubuntu-22.04-node16"
- "ubuntu-22.04-node18"
- "ubuntu-22.04-node20"
4. Fallback Strategy
Keep ubuntu-latest as fallback for:
- Complex builds that need many tools
- Debugging when specialized images fail
- New workloads not yet optimized
5. Performance Impact
Expected Improvements:
- Startup time: 30-60 seconds faster per job
- Image size: 60-70% smaller
- Cache efficiency: Better layer reuse
- Resource usage: Lower memory footprint
Example Timeline:
Current: Checkout (10s) + Setup Java (30s) + Setup Maven (20s) + Run Tests (60s) = 120s
Optimized: Checkout (10s) + Run Tests (60s) = 70s
Savings: 50s per job (42% faster)
Implementation Plan
Phase 1: Update Config Files ✅
- Update
config_heavy.yamlwith specialized images - Update
config_light.yamlwith Node.js images - Update
config_docker.yamlwith Docker-in-Docker image - Update
config_security.yamlwith security tools image
Phase 2: Test and Validate
- Test each runner with optimized images
- Verify all tools are available
- Check performance improvements
- Validate fallback works
Phase 3: Optimize Workflows
- Remove redundant setup steps
- Update matrix strategies
- Add performance monitoring
- Document changes
Phase 4: Monitor and Tune
- Monitor job execution times
- Track resource usage
- Fine-tune based on metrics
- Update documentation
Available Gitea Runner Images
Check Gitea's runner-images repository for available images:
Java Images:
ubuntu-22.04-java17-mavenubuntu-22.04-java21-mavenubuntu-22.04-java17-gradle
Python Images:
ubuntu-22.04-python3.11ubuntu-22.04-python3.12ubuntu-22.04-python3.11-pip
Node.js Images:
ubuntu-22.04-node18ubuntu-22.04-node20ubuntu-22.04-node21
Docker Images:
ubuntu-22.04-dockerubuntu-22.04-docker-compose
Security Images:
ubuntu-22.04-securityubuntu-22.04-trivy
Next Steps
- Test the updated config files with a simple job
- Verify image availability on Gitea's registry
- Update workflows to remove redundant setup steps
- Monitor performance improvements
- Document the changes for the team