321d78a01785b3d0874b78cef5e12dbb0d8f87c2
- Replace gopkg.in/yaml.v3 with github.com/BurntSushi/toml - Update struct tags from yaml to toml - Update config tests to use TOML syntax - Add testdata/config.toml, update Helm configmap template
Proto-Gen Platform
Protobuf code generation platform that generates code from protobuf definitions and delivers to independent Git repos via K8s Jobs.
Features
- Manual trigger: Select language, branch, and repository to generate
- Plugin architecture: Easily add new languages by adding toolchain images
- K8s Jobs: One-time pods for code generation with timeout and retry
- Idempotent: Same proto + branch + language = same output
- SQLite: Zero-ops state storage
Quick Start
Prerequisites
- Go 1.21+
- Kubernetes cluster (K3s/K8s)
- Gitea instance
Build
make build
Run
./build/proto-gen --config config.yaml
Configuration
Copy testdata/config.yaml and modify:
server:
addr: ":8080"
git:
type: gitea
base_url: "https://git.example.com"
token: ${GIT_TOKEN}
cluster:
kubeconfig: /etc/proto-gen/kubeconfig
namespace: proto-gen
job_timeout: 600
max_concurrent: 2
toolchain_registry: "registry.example.com/proto-gen"
Deploy with Helm
helm install proto-gen ./deploy/helm/proto-gen \
--set git.baseUrl=https://git.example.com \
--set git.tokenSecret=proto-gen-git-token
API
| Endpoint | Method | Description |
|---|---|---|
/api/v1/tasks |
POST | Create task |
/api/v1/tasks |
GET | List tasks |
/api/v1/tasks/{id} |
GET | Get task |
/api/v1/tasks/{id}/retry |
POST | Retry task |
/api/v1/plugins |
GET | List plugins |
/api/v1/plugins/{lang}/versions |
GET/PUT | Version management |
Building Toolchain Images
# Go toolchain
docker build -t registry.example.com/proto-gen/proto-gen-go:v1.34.2 ./toolchains/go
# Node.js toolchain
docker build -t registry.example.com/proto-gen/proto-gen-ts:v0.9.0 ./toolchains/nodejs
Architecture
Browser (manual trigger)
│
▼
┌─────────────────── proto-gen (monolith) ───────────────────┐
│ Frontend │ API Server (REST) │ Scheduler (worker) │
└─────────┬───────────────────────────┬──────────────────────┘
│ Gitea API │ K8s API
▼ ▼
Gitea instance K8s Jobs (toolchain images)
Languages
Go
73.6%
JavaScript
6.9%
HTML
6.4%
Shell
5.6%
CSS
4.2%
Other
3.3%