feat: implement proto-gen platform
- Config loader with env var expansion and validation - SQLite database with tasks and toolchain_versions tables - Gitea REST API client for repository and branch operations - K8s client for Job lifecycle management (with noop fallback for local dev) - REST API: tasks CRUD, retry, plugins, version management - Worker/scheduler with polling, concurrency control, and job tracking - Static frontend: generate, tasks, settings pages - Toolchain images: Go and Node.js Dockerfiles with entrypoint scripts - Helm chart with deployment, service, configmap, ingress, PVC - Multi-stage Dockerfile for service - Unit tests for config, database, gitclient, k8s, api, worker - E2E tests for idempotency, version switch, failure recovery
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gitea := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Gitea mock: %s %s", r.Method, r.URL.Path)
|
||||
switch {
|
||||
case r.URL.Path == "/api/v1/repos/test-owner/yoresee_doc/branches/main":
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"name": "main",
|
||||
"commit": map[string]string{"id": "abc123def456"},
|
||||
})
|
||||
case r.URL.Path == "/api/v1/user/repos":
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{"name": "new-repo"})
|
||||
default:
|
||||
w.WriteHeader(404)
|
||||
fmt.Fprintf(w, `{"message": "not found"}`)
|
||||
}
|
||||
}))
|
||||
defer gitea.Close()
|
||||
|
||||
fmt.Printf("Mock Gitea running at: %s\n", fmt.Sprintf(`export GIT_BASE_URL=%s`, gitea.URL))
|
||||
}
|
||||
Reference in New Issue
Block a user