How subanesh-swe/chola works
Purpose and deployable entry points
Chola CI is an on-premises distributed CI/CD orchestrator: a Rust controller schedules and tracks pipeline work, Rust workers execute build stages, and a React dashboard operates the system. Main binaries are crates/ci-controller/src/main.rs, crates/ci-worker/src/main.rs, and crates/ci-job-runner/src/main.rs; the browser entry is frontend/src/main.tsx.
Shared domain and protocol boundary
ci-core centralizes domain models for jobs, job groups, stages, workers, users, schedules, variables, and configuration. It also owns the protobuf contract used between controller and workers/clients: crates/ci-core/proto/orchestrator.proto, generated integration in crates/ci-core/src/proto.rs, and models under crates/ci-core/src/models/.
This is the primary compatibility boundary for distributed components.
Controller: orchestration and API plane
The controller exposes REST and gRPC servers through crates/ci-controller/src/http_server.rs and crates/ci-controller/src/grpc_server.rs. REST handlers provide dashboard, runner, webhook, artifact, log, worker, repository, and administrative operations under crates/ci-controller/src/api/.
Its runtime state coordinates registries, scheduling, DAG evaluation, reservations, and lifecycle cleanup: crates/ci-controller/src/state.rs, crates/ci-controller/src/scheduler.rs, crates/ci-controller/src/dag.rs, and crates/ci-controller/src/reservation.rs.
Pipeline scheduling and worker allocation
Jobs are grouped into multi-stage pipelines with dependency edges and resource requirements. The controller tracks available workers and job groups, selects capacity, reserves stages, and handles timeouts/recovery through crates/ci-controller/src/worker_registry.rs, crates/ci-controller/src/job_registry.rs, crates/ci-controller/src/job_group_registry.rs, and crates/ci-controller/src/retention.rs.
Workers register, heartbeat, reconnect, receive stage work, and report execution status over gRPC.
Worker execution and log path
A worker agent manages controller connectivity and liveness in crates/ci-worker/src/agent.rs, crates/ci-worker/src/grpc_client.rs, and crates/ci-worker/src/heartbeat.rs. Execution is isolated per stage/build and invokes build commands/scripts through crates/ci-worker/src/stage_runner.rs and crates/ci-worker/src/executor.rs.
Logs stream back to the controller via crates/ci-worker/src/log_streamer.rs; the controller aggregates/persists them and exposes live access, including SSE-facing APIs, via crates/ci-controller/src/log_aggregator.rs and crates/ci-controller/src/api/log_handlers.rs.
Persistence, security, and integrations
PostgreSQL is the durable system of record, evolved by migrations/001_init_schema.sql through migrations/034_reserved_stages.sql; controller storage is organized in crates/ci-controller/src/storage.rs. Redis supports transient/distributed state through crates/ci-controller/src/redis_store.rs.
Authentication combines JWT, passwords, API keys, middleware, and worker tokens: crates/ci-controller/src/auth/, crates/ci-controller/src/api/api_key_handlers.rs, and crates/ci-controller/src/api/worker_token_handlers.rs. Webhook ingestion and notifications are handled in crates/ci-controller/src/api/webhook_handlers.rs and crates/ci-controller/src/notifier.rs. Vector configuration supports external log shipping at config/vector.toml.
Operator and automation clients
The React SPA calls the REST API through frontend/src/api/client.ts, enforces authenticated/role-scoped routes in frontend/src/router/ProtectedRoute.tsx and frontend/src/router/RoleGuard.tsx, and visualizes builds/pipelines/logs with frontend/src/pages/BuildDetailPage.tsx and frontend/src/components/pipeline/PipelineGraph.tsx.
ci-job-runner is the automation-facing CLI for reserve, submit, run, status, cancellation, and logs commands: crates/ci-job-runner/src/commands/ and crates/ci-job-runner/src/main.rs.
Main entry points: src/main.rs CI controller · http_server.rs REST API · log_aggregator.rs Log aggregation · src/main.rs CI worker agent
Components 18
Operators & Automation
- React dashboard · Operates builds, pipelines, and live logs.
frontend/src/main.tsx - Job runner CLI · Submits and controls automation jobs.
crates/ci-job-runner/src/main.rs
Shared Contract
- CI domain models · Jobs, pipelines, stages, workers, users, and configuration.
- Orchestrator protocol · Compatibility boundary for distributed components.
crates/ci-core/proto/orchestrator.proto
Controller Plane
- CI controller · Schedules, tracks, and recovers pipeline work.
crates/ci-controller/src/main.rs - REST API · Dashboard, runner, webhook, artifact, log, and administration operations.
crates/ci-controller/src/http_server.rs - Worker gRPC service · Registration, heartbeats, work delivery, and status reporting.
crates/ci-controller/src/grpc_server.rs - Pipeline scheduler · Evaluates DAGs, capacity, reservations, and lifecycle recovery.
crates/ci-controller/src/scheduler.rs - Worker & job registries · Tracks workers, jobs, job groups, and reservations.
crates/ci-controller/src/worker_registry.rs - Log aggregation · Persists worker logs and serves live log access.
crates/ci-controller/src/log_aggregator.rs - Authentication · JWT, passwords, API keys, middleware, and worker tokens.
Worker Execution
- CI worker agent · Maintains controller connectivity and liveness.
crates/ci-worker/src/main.rs - Isolated stage execution · Runs stage commands and scripts per build.
crates/ci-worker/src/stage_runner.rs - Worker log streamer
crates/ci-worker/src/log_streamer.rs
State & Integrations
- PostgreSQL · Stores CI state and history.
migrations/001_init_schema.sql - Redis
crates/ci-controller/src/redis_store.rs - Webhooks & notifications · Ingests repository events and emits notifications.
crates/ci-controller/src/api/webhook_handlers.rs - External log shipping
config/vector.toml
Connections 22
- React dashboard → REST API: REST API and SSE logs
- Job runner CLI → REST API: reserve, submit, control
- React dashboard → Authentication: authenticated access
- REST API → CI controller: operations
- REST API → Authentication: authenticates requests
- REST API → Log aggregation: live and historical logs
- Worker gRPC service → CI controller: worker control plane
- CI controller → Pipeline scheduler: schedules pipelines
- Pipeline scheduler → Worker & job registries: selects and reserves capacity
- Pipeline scheduler → PostgreSQL: durable job state
- CI controller → Redis: transient distributed state
- CI controller → Webhooks & notifications: event ingestion and delivery
- Worker gRPC service → CI worker agent: register, heartbeat, dispatch, status
- CI worker agent → Isolated stage execution: executes assigned stage
- Isolated stage execution → Worker log streamer: execution output
- Worker log streamer → Log aggregation: stream logs
- Log aggregation → PostgreSQL: persist logs
- Log aggregation → External log shipping: ship external logs
- Orchestrator protocol → Worker gRPC service: server contract
- Orchestrator protocol → CI worker agent: client contract
- CI domain models → CI controller: shared domain
- CI domain models → CI worker agent: shared domain