Initial commit: SDLC Orchestrator replacing n8n
Lightweight Hono webhook router that receives Gitea events and creates Coder workspaces for each SDLC stage (analyse, architect, develop, review, test, rework, release, maintenance). Includes k8s manifests for deployment and the Coder workspace template moved from babble. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
# SDLC Orchestrator
|
||||
|
||||
Lightweight webhook-driven orchestrator that replaces n8n for the Gitea + Coder + Claude Code SDLC pipeline.
|
||||
|
||||
Receives Gitea webhooks, routes them to the correct SDLC stage, creates Coder workspaces, and posts status comments back on issues/PRs.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Gitea Webhooks → SDLC Orchestrator → Coder API (creates workspace)
|
||||
→ Gitea API (posts comments)
|
||||
```
|
||||
|
||||
~500 lines of TypeScript. No database, no UI, no state — just a webhook router.
|
||||
|
||||
## Webhook Endpoints
|
||||
|
||||
| Endpoint | Gitea Event | Action |
|
||||
|----------|-------------|--------|
|
||||
| `POST /webhook/gitea-issue-triage` | Issue opened | Route to `analyse` or `fix-bug` |
|
||||
| `POST /webhook/gitea-issue-label` | Issue labeled | Stage transition (architect/develop/test/devops) |
|
||||
| `POST /webhook/gitea-issue-comment` | Comment created | Re-trigger analyst if still in analysis |
|
||||
| `POST /webhook/gitea-pr-review` | PR opened/synced | Trigger code review |
|
||||
| `POST /webhook/gitea-pr-review-rework` | Review submitted | Route to `rework-pr` or `test` |
|
||||
| `POST /webhook/gitea-release` | Release issue | Tag RC or production release |
|
||||
| `GET /health` | — | Health check |
|
||||
|
||||
Plus a cron job (Monday 9 AM) for weekly maintenance.
|
||||
|
||||
## Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 22+
|
||||
- Coder running with the `cloudflare-worker` template (see `coder/`)
|
||||
- Gitea with two bot accounts: `claude-dev` and `claude-review`
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Required | Description |
|
||||
|----------|----------|-------------|
|
||||
| `PORT` | No | HTTP port (default: 3000) |
|
||||
| `CODER_URL` | Yes | Coder API base URL |
|
||||
| `CODER_TOKEN` | Yes | Coder session token |
|
||||
| `CODER_TEMPLATE_ID` | Yes | Coder workspace template ID |
|
||||
| `GITEA_DEV_TOKEN` | Yes | Gitea API token for `claude-dev` |
|
||||
| `GITEA_REVIEW_TOKEN` | Yes | Gitea API token for `claude-review` |
|
||||
| `ANTHROPIC_API_KEY` | Yes | Anthropic API key for Claude Code |
|
||||
| `GITEA_URL` | No | Gitea base URL (default: `https://gitea.samson.media`) |
|
||||
| `BOT_DEV_USERNAME` | No | Dev bot username (default: `claude-dev`) |
|
||||
| `BOT_REVIEW_USERNAME` | No | Review bot username (default: `claude-review`) |
|
||||
| `MAINTENANCE_REPOS` | No | Comma-separated `org/repo=clone_url` for weekly maintenance |
|
||||
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
npm install
|
||||
cp k8s/secret.yaml.example .env # Edit with real values (use KEY=value format)
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Deploy to k3s
|
||||
|
||||
```bash
|
||||
# Build and push image
|
||||
docker build -t registry.samson.media/sdlc-orchestrator:latest .
|
||||
docker push registry.samson.media/sdlc-orchestrator:latest
|
||||
|
||||
# Create secrets
|
||||
cp k8s/secret.yaml.example k8s/secret.yaml
|
||||
# Edit k8s/secret.yaml with real values
|
||||
kubectl apply -f k8s/secret.yaml
|
||||
|
||||
# Deploy
|
||||
kubectl apply -f k8s/deployment.yaml
|
||||
```
|
||||
|
||||
### Configure Gitea Webhooks
|
||||
|
||||
For each project, add these webhooks in **Settings → Webhooks**:
|
||||
|
||||
| Event | URL |
|
||||
|-------|-----|
|
||||
| Issues (opened) | `https://sdlc.samson.media/webhook/gitea-issue-triage` |
|
||||
| Issues (labeled) | `https://sdlc.samson.media/webhook/gitea-issue-label` |
|
||||
| Issue Comments (created) | `https://sdlc.samson.media/webhook/gitea-issue-comment` |
|
||||
| Pull Request (opened, synchronized) | `https://sdlc.samson.media/webhook/gitea-pr-review` |
|
||||
| Pull Request Review (submitted) | `https://sdlc.samson.media/webhook/gitea-pr-review-rework` |
|
||||
| Issues (opened, labeled) — releases | `https://sdlc.samson.media/webhook/gitea-release` |
|
||||
|
||||
## Coder Template
|
||||
|
||||
The `coder/` directory contains the Terraform template for ephemeral Kubernetes workspaces. See `coder/README.md`.
|
||||
|
||||
## Migrating from n8n
|
||||
|
||||
1. Deploy this service to k3s
|
||||
2. Update Gitea webhooks to point to `sdlc.samson.media` instead of `n8n.samson.media`
|
||||
3. Verify with a test issue
|
||||
4. Decommission n8n
|
||||
Reference in New Issue
Block a user