- Add ListPipelines/GetPipeline to CIProvider port with Woodpecker adapter
- Add DNS alias endpoints: GET/POST/DELETE /projects/{id}/domains
- Implement worker executor daemon, build executor, and git operations
- Add build service, worker service, and build audit tracking
- Add worker registry with PostgreSQL adapter and migration
- Add multi-provider code agent interface (Claude Code + OpenCode)
- Add create-and-build combo endpoint
- Update landing-page cookbook to reflect all gaps closed
- Fix tech debt: unified validation, auth scopes, error wrapping, slog patterns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Build Orchestration
Last Updated: 2026-01-27 Confidence: High
Summary
Build orchestration enables structured build specs for bot-driven development. Bots submit build requests with prompts and templates via POST /project/{name}/build, workers execute Claude Code, and callbacks notify completion. All builds are recorded in the build_audit table for observability.
Key Facts:
- BuildSpec: prompt (required), template, variables, auto_commit, auto_push, callback_url
- BuildResult: success, output, error, commit_sha, files_changed, duration_ms, artifacts
- Builds enqueued as work tasks for the worker pool
- Auto-commit/push triggers Woodpecker CI pipeline
- Callback URL receives completion notification with full BuildResult
- Complete audit trail in
build_auditPostgreSQL table
File Pointers:
- Domain:
internal/domain/build.go(BuildSpec, BuildResult, BuildAuditEntry) - Port:
internal/port/build_audit.go(BuildAudit interface) - Adapter:
internal/adapter/postgres/build_audit.go - Service:
internal/service/build_service.go - Handler:
internal/handlers/builds.go(StartBuild, ListBuilds, GetBuild) - Handler:
internal/handlers/create_and_build.go(CreateAndBuild) - Executor:
internal/worker/build_executor.go(BuildSpec→AgentRequest translation) - Git:
internal/worker/git_operations.go(clone, commit, push with token injection) - Migration:
internal/db/migrations/012_worker_registry.sql(build_audit table)
API Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /projects/{id}/builds |
Start a build, returns task_id |
| GET | /projects/{id}/builds |
List builds for project |
| GET | /builds/{taskId} |
Get build status and result |
| POST | /project/create-and-build |
Create project + start build in one call |
Orchestration Flow
- Bot calls
POST /projects/{id}/buildswith BuildSpec (prompt, template, auto_commit, auto_push) - BuildService validates spec (prompt required), creates WorkTask with build spec, enqueues
- Creates BuildAuditEntry with status "pending"
- Returns task ID immediately
- WorkExecutor poll loop claims task from queue
- BuildExecutor translates spec: clones repo, builds AgentRequest, calls CodeAgent.Execute()
- On success with auto_commit: GitOperations commits and pushes changes
- WorkExecutor reports completion with BuildResult
- Audit entry updated, callback URL notified
Build Audit Statuses
pending- enqueued, waiting for workerrunning- worker executingcompleted- finished successfullyfailed- execution failedcancelled- cancelled before completion