|
Download tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-7.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 8.21 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-7.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-7.md
-
curl -L -o MILESTONE-7.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-7.md
8.21 kB
Milestone 7: CI/CD Integration
Status: In Progress Started: 2025-12-21
Overview
Milestone 7 implements decentralized CI/CD pipelines, enabling automated build, test, and deployment workflows. This completes the developer workflow experience by allowing repositories to define and execute continuous integration pipelines that run across the Guts network.
Goals
- Workflow Configuration: YAML-based pipeline definitions (
.guts/workflows/*.yml) - Job Execution: Isolated job execution with step-by-step processing
- Status Checks: Integration with branch protection and PR workflows
- Artifact Management: Store and retrieve build artifacts
- Real-time Logs: Stream build logs to connected clients
- Distributed Execution: Jobs can be executed by any node in the network
New Crate: guts-ci
Technology Choices
| Component | Technology | Rationale |
|---|---|---|
| Config Format | YAML (serde_yaml) | Standard CI/CD config format |
| Isolation | Tokio subprocess | Process isolation for commands |
| Storage | Content-addressed | Artifacts stored by hash |
| Streaming | Channel + WebSocket | Real-time log streaming |
Workflow Configuration
Configuration files are stored in .guts/workflows/*.yml:
Core Types
Workflow
Job Definition
Workflow Run
Job Run
Artifacts
Status Checks
Data Flow
Phase 1: Core Types & Storage
- Create
guts-cicrate structure - Define core types (Workflow, Job, Step, Run)
- Implement YAML workflow parsing
- Create workflow storage
- Add validation for workflow configurations
Phase 2: Workflow Runs
- Implement WorkflowRun tracking
- Create trigger matching logic
- Implement job dependency resolution
- Add run status management
- Create run storage and retrieval
Phase 3: Job Execution
- Implement step executor
- Add environment variable handling
- Create log capture and streaming
- Implement timeout handling
- Add artifact upload/download
Phase 4: Status Checks Integration
- Create StatusCheck type
- Integrate with guts-auth branch protection
- Auto-create checks on workflow trigger
- Update checks on job completion
- Block PR merge on failed required checks
Phase 5: API Endpoints
- GET/POST
/api/repos/{owner}/{name}/workflows - GET
/api/repos/{owner}/{name}/workflows/{workflow_id} - GET/POST
/api/repos/{owner}/{name}/runs - GET
/api/repos/{owner}/{name}/runs/{run_id} - POST
/api/repos/{owner}/{name}/runs/{run_id}/cancel - GET
/api/repos/{owner}/{name}/runs/{run_id}/jobs - GET
/api/repos/{owner}/{name}/runs/{run_id}/jobs/{job_id}/logs - GET/POST
/api/repos/{owner}/{name}/artifacts - GET
/api/repos/{owner}/{name}/commits/{sha}/status - POST
/api/repos/{owner}/{name}/commits/{sha}/statuses
Phase 6: Web UI
- Workflow list page (
/{owner}/{repo}/actions) - Workflow detail page (
/{owner}/{repo}/actions/{workflow}) - Run detail page (
/{owner}/{repo}/actions/runs/{run_id}) - Job log viewer with ANSI color support
- Status badges for README
- Real-time log streaming via WebSocket
Phase 7: CLI Commands
-
guts workflow list- List workflows -
guts workflow run- Trigger workflow manually -
guts run list- List workflow runs -
guts run logs- View run logs -
guts run cancel- Cancel a running workflow
API Reference
Workflow Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/repos/{owner}/{name}/workflows |
List workflows |
| POST | /api/repos/{owner}/{name}/workflows |
Create/update workflow |
| GET | /api/repos/{owner}/{name}/workflows/{id} |
Get workflow details |
| DELETE | /api/repos/{owner}/{name}/workflows/{id} |
Delete workflow |
Run Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/repos/{owner}/{name}/runs |
List runs |
| POST | /api/repos/{owner}/{name}/runs |
Trigger manual run |
| GET | /api/repos/{owner}/{name}/runs/{id} |
Get run details |
| POST | /api/repos/{owner}/{name}/runs/{id}/cancel |
Cancel run |
| POST | /api/repos/{owner}/{name}/runs/{id}/rerun |
Re-run workflow |
Job Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/repos/{owner}/{name}/runs/{id}/jobs |
List jobs in run |
| GET | /api/repos/{owner}/{name}/runs/{id}/jobs/{job} |
Get job details |
| GET | /api/repos/{owner}/{name}/runs/{id}/jobs/{job}/logs |
Get job logs |
Artifact Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/repos/{owner}/{name}/runs/{id}/artifacts |
List artifacts |
| POST | /api/repos/{owner}/{name}/runs/{id}/artifacts |
Upload artifact |
| GET | /api/repos/{owner}/{name}/runs/{id}/artifacts/{name} |
Download artifact |
| DELETE | /api/repos/{owner}/{name}/runs/{id}/artifacts/{name} |
Delete artifact |
Status Check Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/repos/{owner}/{name}/commits/{sha}/status |
Get combined status |
| GET | /api/repos/{owner}/{name}/commits/{sha}/statuses |
List all statuses |
| POST | /api/repos/{owner}/{name}/commits/{sha}/statuses |
Create status check |
WebSocket Events
New event types for CI/CD:
| Event | Description |
|---|---|
workflow_run.requested |
Workflow run created |
workflow_run.in_progress |
Workflow run started |
workflow_run.completed |
Workflow run finished |
workflow_job.queued |
Job queued |
workflow_job.in_progress |
Job started |
workflow_job.completed |
Job finished |
check_run.created |
Status check created |
check_run.completed |
Status check completed |
Built-in Actions
The following actions are available by default:
| Action | Description |
|---|---|
checkout |
Checkout repository at current commit |
cache |
Cache dependencies between runs |
upload-artifact |
Upload build artifacts |
download-artifact |
Download artifacts from other jobs |
Success Criteria
- Workflows parse correctly from YAML
- Jobs execute in correct dependency order
- Status checks integrate with branch protection
- Logs stream in real-time via WebSocket
- Artifacts can be uploaded and downloaded
- Web UI shows workflow runs and logs
- CLI can trigger and monitor workflows
- Failed required checks block PR merge
Security Considerations
- Sandboxing: Jobs run in isolated environments
- Secrets Management: Encrypted secret storage (future)
- Timeout Limits: Prevent runaway jobs
- Resource Limits: Cap CPU/memory per job
- Network Isolation: Restrict network access in jobs
- Audit Logging: Log all CI/CD operations
Performance Considerations
- Parallel Jobs: Jobs without dependencies run in parallel
- Caching: Cache build dependencies
- Incremental Builds: Only rebuild changed components
- Log Compression: Compress stored logs
- Artifact Deduplication: Content-addressed storage
Future Enhancements
These features are out of scope for Milestone 7 but planned:
- Secrets Management: Encrypted secrets for workflows
- Self-hosted Runners: Custom execution environments
- Matrix Builds: Parallel builds across configurations
- Reusable Workflows: Import workflows from other repos
- Workflow Templates: Pre-built workflow templates
- Cost Attribution: Track compute usage per repository
Dependencies
guts-auth: Branch protection, permissionsguts-collaboration: PR status integrationguts-realtime: WebSocket event streamingguts-storage: Artifact storageserde_yaml: YAML parsingtokio: Async execution