From 2c7c0650caa05b19dfc1c725f2efb4d8305937c8 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Fri, 22 May 2026 10:22:32 +0000 Subject: [PATCH] Update README.md --- README.md | 133 ++++++++++++++++++------------------------------------ 1 file changed, 43 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index b4762f1..353282c 100644 --- a/README.md +++ b/README.md @@ -1,126 +1,79 @@ -# cicd-server -轻量级自托管 CI/CD 平台。单个 Go 二进制文件,从源码构建容器镜像并推送到镜像仓库。面向小型团队(约 30 人)设计。 -## 功能特性 +# CICD-CC-Platform -- 自动语言检测(Go、Node.js、Python、Java、Ruby、Dockerfile) -- 无 Dockerfile 时自动生成 -- Git Webhook 触发构建(支持 GitHub / GitLab / Gitea) -- WebSocket 实时构建日志推送 -- 多 Worker 构建队列(可配置并发数) -- Web 管理界面 +A lightweight self-hosted CI/CD platform written in Go. This single binary solution builds container images from source code and pushes them to container registries, designed for small teams. -## 快速开始 +## Features -### 环境要求 +- **Multi-language Detection**: Automatically detects Go, Node.js, Python, Java, Ruby, or custom Dockerfile +- **Auto-generate Dockerfile**: Creates optimal Dockerfiles when none exists +- **Git Webhook Triggers**: Supports GitHub, GitLab, and Gitea webhooks +- **Real-time Logs**: WebSocket-powered live build log streaming +- **Multi-Worker Queue**: Configurable concurrent build workers +- **Web Management UI**: Modern React-based interface + +## Quick Start + +### Prerequisites - Go 1.25+ -- Docker(用于构建镜像) -- Node.js 20+(用于前端开发) +- Docker (for building images) +- Node.js 20+ (for frontend development) -### 后端 +### Backend Setup ```bash -# 设置必要的环境变量 +# Set required environment variables export JWT_SECRET=your-secret-here -# 开发模式运行 +# Run in development mode make dev -# 或编译后运行 +# Or compile and run make run ``` -服务默认监听 `http://localhost:8080`。 +The server listens on `http://localhost:8080` by default. -### 前端 +### Frontend ```bash make frontend ``` -Vite 开发服务器启动在 `http://localhost:5173`,API 请求自动代理到 `:8080`。 +The Vite dev server runs on `http://localhost:5173`, with API requests proxied to `:8080`. -### Docker 部署 +### Docker Deployment ```bash make docker docker run -p 8080:8080 -e JWT_SECRET=your-secret cicd-server:latest ``` -## 环境变量 - -| 变量名 | 默认值 | 说明 | -|---|---|---| -| `PORT` | `8080` | HTTP 监听端口 | -| `DATABASE_PATH` | `cicd.db` | SQLite 数据库文件路径 | -| `JWT_SECRET` | `change-me-in-production` | JWT 签名密钥(生产环境必须修改) | -| `JWT_EXPIRY_HOURS` | `72` | Token 有效期(小时) | -| `BUILD_WORKERS` | `3` | 并发构建 Worker 数量 | -| `BUILD_DIR` | `/tmp/cicd-builds` | Git 克隆临时目录 | -| `BUILD_BACKEND` | `docker` | 构建后端:`docker`、`kaniko`、`buildah` | -| `K8S_NAMESPACE` | `cicd` | Kubernetes 命名空间(仅 kaniko 使用) | - -## API 接口 - -所有端点位于 `/api/v1` 下,使用 JWT Bearer Token 进行身份认证。 +## Environment Variables -### 公开接口 +| Variable | Default | Description | +|----------|---------|-------------| +| `PORT` | `8080` | HTTP listen port | +| `DATABASE_PATH` | `cicd.db` | SQLite database file path | +| `JWT_SECRET` | `change-me-in-production` | JWT signing key (must change in production) | +| `JWT_EXPIRY_HOURS` | `72` | Token expiration time (hours) | +| `BUILD_WORKERS` | `3` | Concurrent build worker count | +| `BUILD_DIR` | `/tmp/cicd-builds` | Git clone temporary directory | +| `BUILD_BACKEND` | `docker` | Build backend: `docker`, `kaniko`, or `buildah` | +| `K8S_NAMESPACE` | `cicd` | Kubernetes namespace (kaniko only) | -| 方法 | 路径 | 说明 | -|---|---|---| -| `POST` | `/auth/register` | 注册账号 | -| `POST` | `/auth/login` | 登录获取 Token | -| `POST` | `/webhooks/{projectID}` | Git Webhook 回调 | +## API Endpoints -### 需认证接口(请求头 `Authorization: Bearer `) - -| 方法 | 路径 | 说明 | -|---|---|---| -| `GET/POST` | `/projects` | 项目列表 / 创建项目 | -| `GET/PUT/DELETE` | `/projects/{id}` | 项目详情 / 更新 / 删除 | -| `GET/POST` | `/builds` | 构建列表 / 触发构建 | -| `GET` | `/builds/{id}` | 构建详情 | -| `WS` | `/builds/{id}/ws` | 实时构建日志(WebSocket) | - -## 项目结构 - -``` -cmd/server/ 应用入口 -internal/ - api/ HTTP 路由、处理器、中间件 - build/ 构建引擎、语言检测器、日志流 - store/ 数据访问层(SQLite + GORM) - model/ 数据模型(User、Project、Build、BuildLog) - auth/ JWT 认证 + bcrypt 密码哈希 - config/ 环境变量配置 -web/ 前端(React 19 + TypeScript + Ant Design 6) -deploy/ Dockerfile、Kubernetes 配置 -docs/ 架构文档、迭代规划 -``` +All endpoints are prefixed with `/api/v1` and use JWT Bearer Token authentication. -## 构建流水线 - -``` -Git Push → Webhook 触发 → 克隆仓库 → 检测语言 → 生成 Dockerfile → docker build → docker push -``` - -## 开发指南 - -```bash -# 后端 -make dev # go run 启动开发服务器 -make build # 编译到 bin/ 目录 - -# 前端 -make frontend # 安装依赖 + 启动 Vite 开发服务器 -cd web && npm run lint # 代码检查 - -# Docker -make docker # 构建容器镜像 -``` +### Public Endpoints -## 开源协议 +| Method | Path | Description | +|--------|------|-------------| +| `POST` | `/auth/register` | Register new account | +| `POST` | `/auth/login` | Login and obtain token | +| `POST` | `/webhooks/{projectID}` | Git webhook callback | -MIT +### Authenticated Endpoints (Header: `Authorization: Bearer \ No newline at end of file -- Gitee