### POST /install/step-source Source: https://github.com/gitee-go/server/blob/main/api.md Initializes the data source during the installation process. ```APIDOC ## POST /install/step-source ### Description Initializes the data source for the installation process. ### Method POST ### Endpoint /install/step-source ### Parameters #### Request Body - **source** (string) - Required - **clientId** (string) - Required - **clientSecret** (string) - Required - **sourceHost** (string) - Required ### Response #### Success Response (200) - **code** (string) - **data** (object) - **loginUrl** (string) - **sourceUrl** (object) - **app** (string) - **back** (string) ``` -------------------------------- ### Application Configuration Example Source: https://context7.com/gitee-go/server/llms.txt Example of the application.yaml configuration file. It covers server, runner, and datasource settings. ```yaml # application.yaml 配置示例 server: host: http://localhost:8090 # Server 外部访问地址 port: "8090" # Server 端口 login-key: jWgXS7tlfqSq4F8K # JWT 签名密钥 workspace: "" # 工作空间路径(默认 ~/.giteeGo) limit: build: 10 # 最大同时构建数 parse: 10 # 最大同时解析 YML 数 runner: port: "7030" # Runner RPC 端口 secret: jWgXS7tlfqSq4F8KnR # Runner 通信密钥 main-runner: true # 是否启动集成 Runner datasource: host: localhost # MySQL 主机 port: 3306 # MySQL 端口 database: gitee_go # 数据库名 username: root # 用户名 password: password # 密码 showsql: false # 是否显示 SQL ``` -------------------------------- ### Check Installation Status API Source: https://context7.com/gitee-go/server/llms.txt Use this GET request to check the current installation status of the system. No parameters are required. ```bash curl -X GET http://localhost:8090/api/install/check ``` -------------------------------- ### POST /install/step-data Source: https://github.com/gitee-go/server/blob/main/api.md Initializes the database connection for the GiteeGo installation process. ```APIDOC ## POST /install/step-data ### Description Initializes the database. Returns code 100 if waiting for the database, code 0 for success, and other codes for errors. ### Method POST ### Endpoint /install/step-data ### Parameters #### Request Body - **host** (string) - Optional - **port** (string) - Required - **database** (string) - Required - **username** (string) - Required - **password** (string) - Required ### Response #### Success Response (200) - **code** (string) - Status code - **data** (string[]) - Source list ``` -------------------------------- ### POST /install/step-host Source: https://github.com/gitee-go/server/blob/main/api.md Configures the initial host settings for the GiteeGo installation. ```APIDOC ## POST /install/step-host ### Description Configures the initial host for the installation process. ### Method POST ### Endpoint /install/step-host ### Parameters #### Request Body - **host** (string) - Optional ``` -------------------------------- ### GET /api/install/check Source: https://context7.com/gitee-go/server/llms.txt Checks the current installation status of the system. ```APIDOC ## GET /api/install/check ### Description Checks if the system is installed or requires initialization. ### Method GET ### Endpoint http://localhost:8090/api/install/check ``` -------------------------------- ### Application Configuration Source: https://github.com/gitee-go/server/blob/main/readme.md Example application.yaml configuration for server and runner settings. ```yaml server: host: http://localhost:8090 # server外部访问地址 port: "8090" # server的端口 login-key: jWgXS7tlfqSq4F8KnRVuuNM9XM7e # runner与server通信的密钥 workspace: "" limit: build: 10 # 最大同时构建数 parse: 10 # 最大同时解析yml数 runner: port: "7030" # runner端口 secret: jWgXS7tlfqSq4F8KnRVuuNM9XM7eP9iZ # runner与server通信的密钥 main-runner: true # 是否启动server的集成runner,一个server只能有一个main-runner datasource: # 数据库 host: xx port: xx database: xx username: xx password: xx showsql: true artifactory: {} #暂时没用 ``` -------------------------------- ### VS Code Launch Configuration Source: https://github.com/gitee-go/server/blob/main/readme.md Example launch.json configuration for debugging the server in VS Code. ```json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch Package", "type": "go", "request": "launch", "mode": "auto", "program": "${workspaceFolder}/main.go" } ] } ``` -------------------------------- ### Runner RPC: Download Repository Source: https://context7.com/gitee-go/server/llms.txt Go example for a runner to download repository code. It takes a buildId and returns the repository content as a byte slice. ```go func downloadRepo(buildId string) ([]byte, error) { client := hbtp.NewClient("server:7030") client.SetAuth(runnerSecret) resp, err := client.Call("RunnerRPC.DownBuildRepo", buildId) if err != nil { return nil, err } return resp.ReadAll() } ``` -------------------------------- ### Get Repository List API Source: https://context7.com/gitee-go/server/llms.txt Fetches a list of repositories accessible by the current user, supporting pagination and search. Requires an 'Authorization' header. ```bash curl -X POST http://localhost:8090/api/repo/getRepos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "page": 1, "size": 20, "q": "my-project" }' ``` ```json { "code": 200, "data": { "total": 50, "page": 1, "size": 20, "data": [ { "id": "repo123", "openid": "gitee_repo_456", "name": "my-project", "owner": "username", "active": 1, "visible": 1 } ] } } ``` -------------------------------- ### Runner RPC: Upload Build Log Source: https://context7.com/gitee-go/server/llms.txt Go example for a runner to upload build logs. It requires buildId, jobId, and log data in CmdLogLineJson format. Headers for buildid and jobid are set. ```go func uploadLog(buildId, jobId string, log *hbtpBean.CmdLogLineJson) error { client := hbtp.NewClient("server:7030") client.SetAuth(runnerSecret) client.SetHeader("buildid", buildId) client.SetHeader("jobid", jobId) _, err := client.Call("RunnerRPC.JobLogJson", log) return err } ``` -------------------------------- ### Runner RPC: Upload Artifact Source: https://context7.com/gitee-go/server/llms.txt Go example for a runner to upload build artifacts. It requires buildId, artId, and the artifact data. The artifact size is included in the parameters. ```go func uploadArtifact(buildId, artId string, data []byte) error { client := hbtp.NewClient("server:7030") client.SetAuth(runnerSecret) params := map[string]interface{}{ "buildid": buildId, "artid": artId, "art_size": len(data), } resp, err := client.Call("RunnerRPC.UploadArtPipe", params) if err != nil { return err } return client.WriteBody(data) } ``` -------------------------------- ### Download Artifacts API Source: https://context7.com/gitee-go/server/llms.txt Use this GET request to download artifacts. Provide artifact IDs using the 'id' query parameter. The downloaded content will be saved to 'artifacts.zip'. ```bash curl -X GET "http://localhost:8090/api/pipeline/artifact/downs?id=art001&id=art002" \ -H "Authorization: Bearer " \ -o artifacts.zip ``` -------------------------------- ### GET /pipeline/artifact/downs Source: https://github.com/gitee-go/server/blob/main/api.md Downloads build artifacts in batch. ```APIDOC ## GET /pipeline/artifact/downs ### Description Downloads multiple build artifacts. ### Method GET ### Endpoint /pipeline/artifact/downs ### Parameters #### Query Parameters - **authToken** (string) - Required - Login token - **id** (string) - Required - ID array ``` -------------------------------- ### Get Artifact List API Source: https://context7.com/gitee-go/server/llms.txt Use this POST request to retrieve a list of build artifacts. The jobId must be specified in the request body. ```bash curl -X POST http://localhost:8090/api/pipeline/artifacts \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "jobId": "job001" }' ``` -------------------------------- ### Get Pipeline List API Source: https://context7.com/gitee-go/server/llms.txt Retrieves a list of all pipeline configurations for a specified repository, including the latest run status. Requires 'repoId', pagination parameters, and an 'Authorization' header. ```bash curl -X POST http://localhost:8090/api/repo/getPipelines \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123", "page": 1, "size": 20 }' ``` ```json { "code": 200, "data": { "total": 5, "page": 1, "size": 20, "data": [ { "id": "pipe001", "name": "build", "displayName": "构建流水线", "repoId": "repo123", "pipelineType": "yaml", "status": "success", "commitMsg": "feat: add new feature", "expendTime": 120 } ] } } ``` -------------------------------- ### Get Build Details API Source: https://context7.com/gitee-go/server/llms.txt Retrieves detailed information about a specific build, including the status of its stages and jobs. Requires a pipeline version ID. ```bash # 获取构建详情 curl -X POST http://localhost:8090/api/pipeline/versionDetails \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "pipelineVersionId": "version001" }' ``` ```json # 响应示例 { "code": 200, "data": { "id": "version001", "pipelineId": "pipe001", "branch": "master", "commitSha": "abc123def", "status": "success", "stages": [ { "id": "stage001", "name": "build", "status": "success", "expendTime": 60, "jobs": [ { "id": "job001", "name": "compile", "status": "success", "expendTime": 45 } ] } ] } } ``` -------------------------------- ### Get Project Pipelines Source: https://github.com/gitee-go/server/blob/main/api.md Retrieves a list of pipelines for a given project. Supports pagination. ```APIDOC ## GET /api/v5/projects/{id}/pipelines ### Description Retrieves a list of pipelines for a given project. Supports pagination. ### Method GET ### Endpoint /api/v5/projects/{id}/pipelines ### Parameters #### Query Parameters - **repoId** (string) - Optional - Repository ID. - **pipelineId** (string) - Optional - Pipeline ID. - **page** (number) - Optional - Page number for pagination. - **size** (number) - Optional - Number of items per page. ### Request Example ```json { "repoId": "your_repo_id", "pipelineId": "your_pipeline_id", "page": 1, "size": 10 } ``` ### Response #### Success Response (200) - **pipelines** (array) - List of pipelines. - **total** (number) - Total number of pipelines. #### Response Example ```json { "pipelines": [ { "id": "pipeline_123", "name": "Build and Deploy", "status": "success", "created_at": "2023-10-27T10:00:00Z" } ], "total": 50 } ``` ``` -------------------------------- ### Webhook Interface API (Gitee Push) Source: https://context7.com/gitee-go/server/llms.txt Receives Webhook events from code hosting platforms like Gitee to automatically trigger pipeline builds. This example shows a Gitee Push Hook. Requires specific Gitee headers. ```bash # Gitee Webhook 推送 curl -X POST http://localhost:8090/api/repos/hooks/gitee \ -H "Content-Type: application/json" \ -H "X-Gitee-Event: Push Hook" \ -H "X-Gitee-Token: webhook_secret" \ -d '{ "ref": "refs/heads/master", "repository": { "id": 12345, "full_name": "owner/repo" }, "commits": [ { "id": "abc123def", "message": "feat: add new feature" } ] }' ``` ```json # 响应示例 { "code": 200, "data": null } ``` -------------------------------- ### Runner RPC: Pull Job Source: https://context7.com/gitee-go/server/llms.txt Go example for a runner to pull a job. The runner polls every 100ms. Ensure the runner secret is set for authentication. ```go func pullJob() (*runtime.RunJob, error) { client := hbtp.NewClient("server:7030") client.SetAuth(runnerSecret) resp, err := client.Call("RunnerRPC.JobPull", nil) if err != nil { return nil, err } var job runtime.RunJob if err := json.Unmarshal(resp.Body, &job); err != nil { return nil, err } return &job, nil } ``` -------------------------------- ### Get Build Log API Source: https://context7.com/gitee-go/server/llms.txt Fetches the build log for a specific Job, supporting incremental reads via the offset parameter. Requires a job ID, offset, and limit. ```bash # 获取构建日志 curl -X POST http://localhost:8090/api/pipeline/jobLog \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "jobId": "job001", "offset": 0, "limit": 100 }' ``` ```json # 响应示例 { "code": 200, "data": [ { "id": "log001", "gid": "group001", "pid": "step001", "type": "cmdout", "content": "go build -o main ./...", "times": "2024-01-15T10:00:30Z", "code": 0, "offset": 256 } ] } ``` -------------------------------- ### Get User Info API Source: https://context7.com/gitee-go/server/llms.txt Retrieves detailed information for the currently logged-in user. Requires an 'Authorization' header with a valid JWT token. ```bash curl -X POST http://localhost:8090/api/login/info \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " ``` ```json { "code": 200, "data": { "login": true, "id": "1", "name": "admin", "nick": "管理员", "avatar": "https://example.com/avatar.png", "loginTime": "2024-01-15 10:30:00", "regTime": "2024-01-01 00:00:00" } } ``` -------------------------------- ### Get Build History API Source: https://context7.com/gitee-go/server/llms.txt Fetches the build history for a repository, with support for filtering by branch, event type, and status. Requires 'repoId', 'pipelineId', pagination parameters, and an 'Authorization' header. ```bash curl -X POST http://localhost:8090/api/repo/builds \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123", "pipelineId": "pipe001", "branch": "master", "events": "push", "status": "success", "page": 1, "size": 20 }' ``` ```json { "code": 200, "data": { "total": 100, "page": 1, "size": 20, "data": [ { "id": "version001", "pipelineId": "pipe001", "branch": "master", "commitSha": "abc123def", "commitMessage": "feat: add new feature", "status": "success", "trigger": "webhook", "events": "push", "started": "2024-01-15 10:00:00", "finished": "2024-01-15 10:02:00", "expendTime": 120 } ] } } ``` -------------------------------- ### Get Branch YAML Files API Source: https://context7.com/gitee-go/server/llms.txt Retrieves all pipeline YAML configuration files for a specified branch within a repository. Requires repository ID and branch name. ```bash # 获取分支 YAML 文件 curl -X POST http://localhost:8090/api/repo/branch/ymls \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123", "branch": "master" }' ``` ```json # 响应示例 { "code": 200, "data": [ { "fileName": "build.yaml", "sha": "abc123", "name": "build", "content": "name: build\nstages:\n - name: compile..." } ] } ``` -------------------------------- ### Build and Run Server Source: https://github.com/gitee-go/server/blob/main/readme.md Commands to compile and execute the server binary. ```bash export CGO_ENABLED=0 go build -o server main.go chmod +x server ./server ``` -------------------------------- ### Clone and Initialize Repository Source: https://github.com/gitee-go/server/blob/main/readme.md Commands to clone the repository and initialize Go modules. ```bash git clone https://gitee.com/gitee-go/server.git cd server ``` ```bash go mod tidy ``` -------------------------------- ### GET /pipeline/downJobLog/:id Source: https://github.com/gitee-go/server/blob/main/api.md Downloads the log for a specific job within a pipeline. ```APIDOC ## GET /pipeline/downJobLog/:id ### Description Downloads the log for a specific job within a pipeline. ### Method GET ### Endpoint /pipeline/downJobLog/:id ### Parameters #### Path Parameters - **id** (string) - Required - jobId #### Query Parameters - **authToken** (string) - Required - login token ``` -------------------------------- ### GET /pipeline/downLog/:id Source: https://github.com/gitee-go/server/blob/main/api.md Downloads the build log for a specific pipeline version. ```APIDOC ## GET /pipeline/downLog/:id ### Description Downloads the build log for a specific pipeline version. ### Method GET ### Endpoint /pipeline/downLog/:id ### Parameters #### Path Parameters - **id** (string) - Required - pipelineVersionId #### Query Parameters - **authToken** (string) - Required - login token ``` -------------------------------- ### GET /pipeline/artifact/down/:id Source: https://github.com/gitee-go/server/blob/main/api.md Downloads a specific build artifact using the artifact ID and authentication token. ```APIDOC ## GET /pipeline/artifact/down/:id ### Description Downloads a build artifact. ### Method GET ### Endpoint /pipeline/artifact/down/:id ### Parameters #### Path Parameters - **id** (string) - Required - id or xid #### Query Parameters - **authToken** (string) - Required - login token - **name** (string) - Required - 文件名 ``` -------------------------------- ### POST /namespace/namespace Source: https://github.com/gitee-go/server/blob/main/api.md Creates or manages a namespace. ```APIDOC ## POST /namespace/namespace ### Description Endpoint for namespace operations. ### Method POST ### Endpoint /namespace/namespace ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **Authorization** (string) - Required - JWT token ``` -------------------------------- ### Get Repository Branches API Source: https://context7.com/gitee-go/server/llms.txt Fetches a list of all branches for a given repository. Requires a repository ID. ```bash # 获取仓库分支 curl -X POST http://localhost:8090/api/repo/branch/branches \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123" }' ``` ```json # 响应示例 { "code": 200, "data": [ {"name": "master", "protected": true}, {"name": "develop", "protected": false}, {"name": "feature/new-api", "protected": false} ] } ``` -------------------------------- ### POST /plugin/plugins Source: https://github.com/gitee-go/server/blob/main/api.md Query available plugins. ```APIDOC ## POST /plugin/plugins ### Description Query available plugins. ### Method POST ### Endpoint /plugin/plugins ### Parameters #### Headers - **Content-Type** (string) - Required - application/x-www-form-urlencoded - **Authorization** (string) - Required - JWT token for authentication ### Response #### Success Response (200) - **code** (number) - Status code - **msg** (string) - Status message - **data** (string[]) - List of plugins ``` -------------------------------- ### Configure Code Source API Source: https://context7.com/gitee-go/server/llms.txt Use this POST request to configure the code source integration. Provide the source type, clientId, and clientSecret. ```bash curl -X POST http://localhost:8090/api/install/step-source \ -H "Content-Type: application/json" \ -d '{ "source": "gitee", "clientId": "your_client_id", "clientSecret": "your_client_secret" }' ``` -------------------------------- ### Activate Repository API Source: https://context7.com/gitee-go/server/llms.txt Activates a repository to enable CI/CD features and automatically configure webhooks. Requires the repository's 'openid' and an 'Authorization' header. ```bash curl -X POST http://localhost:8090/api/repo/activeRepo \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "openid": "gitee_repo_456" }' ``` ```json { "code": 200, "data": null } ``` -------------------------------- ### Get Message List API Source: https://context7.com/gitee-go/server/llms.txt Use this POST request to retrieve a list of notifications. Specify pagination and filtering criteria in the request body. ```bash curl -X POST http://localhost:8090/api/notice/notices \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "page": 1, "size": 20, "types": "build", "status": "0" }' ``` -------------------------------- ### User and Read Configuration Parameters Source: https://github.com/gitee-go/server/blob/main/api.md Defines the required string parameters for user creation and read-time settings. ```APIDOC ## Parameters ### Request Body - **readtm** (string) - Required - Read time configuration. - **creatUser** (string) - Required - User creation identifier. ``` -------------------------------- ### Configure Database API Source: https://context7.com/gitee-go/server/llms.txt Use this POST request to configure the database connection. All required parameters (host, port, database, username, password) must be provided in the JSON body. ```bash curl -X POST http://localhost:8090/api/install/step-data \ -H "Content-Type: application/json" \ -d '{ "host": "localhost", "port": "3306", "database": "gitee_go", "username": "root", "password": "password" }' ``` -------------------------------- ### POST /repo/activeRepo - Activate Repository Source: https://github.com/gitee-go/server/blob/main/api.md Activates a repository on Gitee Go Server. Requires authentication via Authorization header. ```APIDOC ## POST /repo/activeRepo ### Description Activates a repository on Gitee Go Server. ### Method POST ### Endpoint /repo/activeRepo ### Parameters #### Path Parameters None #### Query Parameters None #### Headers - **Content-Type** (string) - Required - application/json - **Authorization** (string) - Required - JWT token for authentication #### Request Body - **openid** (string) - Optional - User's openid - **org** (string) - Optional - Organization name - **owner** (string) - Optional - Repository owner - **name** (string) - Optional - Repository name - **url** (string) - Optional - Repository URL - **repoType** (string) - Optional - Type of the repository ### Request Example ```json { "openid": "example_openid", "org": "example_org", "owner": "example_owner", "name": "example_repo", "url": "https://example.com/repo.git", "repoType": "public" } ``` ### Response #### Success Response (200) - **code** (number) - Status code of the operation - **msg** (string) - Message describing the result - **data** (object []) - Array of objects containing repository details - **name** (string) - Name of the repository item - **displayName** (string) - Display name of the repository item - **content** (string) - Content of the repository item #### Response Example ```json { "code": 200, "msg": "Success", "data": [ { "name": "repo1", "displayName": "Repository One", "content": "Details about repo1" } ] } ``` ``` -------------------------------- ### POST /api/manual/rebuild Source: https://context7.com/gitee-go/server/llms.txt Re-executes a previous build. ```APIDOC ## POST /api/manual/rebuild ### Description Re-runs a specific historical build version. ### Method POST ### Endpoint http://localhost:8090/api/manual/rebuild ### Request Body - **pipelineVersionId** (string) - Required - Build version ID ### Request Example { "pipelineVersionId": "version001" } ### Response #### Success Response (200) - **code** (integer) - Status code - **data** (object) - New build version details #### Response Example { "code": 200, "data": { "id": "version002", "pipelineId": "pipe001", "branch": "master", "openid": "gitee_repo_456" } } ``` -------------------------------- ### Private Repository Dependency Fetching Source: https://github.com/gitee-go/server/blob/main/readme.md Scripts for fetching dependencies when working with private repositories. ```bash ./goget.sh or ./goget.bash ``` -------------------------------- ### Runner RPC: Update Job Status Source: https://context7.com/gitee-go/server/llms.txt Go example for a runner to update the status of a job. This function requires a ReqJobUpdate struct containing the job's update information. ```go func updateJobStatus(info *runtime.ReqJobUpdate) error { client := hbtp.NewClient("server:7030") client.SetAuth(runnerSecret) _, err := client.Call("RunnerRPC.JobUpdate", info) return err } ``` -------------------------------- ### POST /repo/getRepos Source: https://github.com/gitee-go/server/blob/main/api.md Retrieves a paginated list of repositories from the Gitee Go Server. ```APIDOC ## POST /repo/getRepos ### Description Retrieves a paginated list of repositories from the Gitee Go Server. ### Method POST ### Endpoint /repo/getRepos ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **Authorization** (string) - Required - Example: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0aW1lb3V0IjoiMjAyMS0wNi0wMlQxODoyMTo1My44MTUxNzEzMSswODowMCIsInRpbWVzIjoiMjAyMS0wNS0yOFQxODoyMTo1My44MTUxNzA2MjErMDg6MDAiLCJ1aWQiOiIxNyJ9.FUZgfvoLvSoLmICSR1_N8vABh2skTWQDHLGabqdm41ELX7n8Wd9xvgayUNW_nyLoGd825ZFNzwR4faCf3Y_9Nw #### Request Body - **page** (number) - Optional - - **size** (number) - Optional - - **q** (string) - Optional - - **namespace** (string) - Optional - ### Response #### Success Response (200) - **code** (number) - Optional - - **msg** (string) - Optional - - **data** (object) - Optional - #### Response Example { "code": 0, "msg": "Success", "data": { "total": 100, "list": [ { "id": 1, "name": "example-repo", "namespace": "example-user" } ] } } ``` -------------------------------- ### POST /api/repo/activeRepo Source: https://context7.com/gitee-go/server/llms.txt Activates a repository for CI/CD functionality. ```APIDOC ## POST /api/repo/activeRepo ### Description Enables CI/CD for a repository and configures Webhooks. ### Method POST ### Endpoint http://localhost:8090/api/repo/activeRepo ### Request Body - **openid** (string) - Required - Repository unique identifier ### Request Example { "openid": "gitee_repo_456" } ### Response #### Success Response (200) - **code** (integer) - Status code #### Response Example { "code": 200, "data": null } ``` -------------------------------- ### POST /repo/setting/universal Source: https://github.com/gitee-go/server/blob/main/api.md Updates universal settings for a repository. ```APIDOC ## POST /repo/setting/universal ### Description Updates general or universal settings for a repository. ### Method POST ### Endpoint /repo/setting/universal ``` -------------------------------- ### Repository Variable Management API Source: https://context7.com/gitee-go/server/llms.txt Manages environment variables at the repository level, which can be referenced within pipelines. Includes endpoints for getting, saving, and deleting variables. Requires repository ID and variable details for saving/deleting. ```bash # 获取仓库变量 curl -X POST http://localhost:8090/api/repo/setting/variables \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123", "page": 1, "size": 20 }' ``` ```bash # 保存仓库变量 curl -X POST http://localhost:8090/api/repo/setting/saveVariable \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "repoId": "repo123", "name": "DEPLOY_ENV", "value": "production", "remarks": "部署环境", "public": 0, "readOnly": 0 }' ``` ```bash # 删除仓库变量 curl -X POST http://localhost:8090/api/repo/setting/deleteVariables \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "id": "var001" }' ``` -------------------------------- ### POST /api/manual/build Source: https://context7.com/gitee-go/server/llms.txt Manually triggers a build for a specific pipeline and branch. ```APIDOC ## POST /api/manual/build ### Description Triggers a new build execution. ### Method POST ### Endpoint http://localhost:8090/api/manual/build ### Request Body - **pipelineId** (string) - Required - Pipeline ID - **branch** (string) - Required - Branch name ### Request Example { "pipelineId": "pipe001", "branch": "master" } ### Response #### Success Response (200) - **code** (integer) - Status code #### Response Example { "code": 200, "data": null } ``` -------------------------------- ### POST /manual/rebuild Source: https://github.com/gitee-go/server/blob/main/api.md Triggers a manual rebuild process. ```APIDOC ## POST /manual/rebuild ### Description Initiates a manual rebuild of the pipeline. ### Method POST ### Endpoint /manual/rebuild ``` -------------------------------- ### POST /repo/setting/variables - Query Environment Variables Source: https://github.com/gitee-go/server/blob/main/api.md This endpoint allows you to query environment variables for a repository. It supports filtering and pagination. ```APIDOC ## POST /repo/setting/variables ### Description Queries environment variables for a repository. ### Method POST ### Endpoint /repo/setting/variables ### Parameters #### Path Parameters None #### Query Parameters None #### Headers - **Content-Type** (string) - Required - application/json - **Authorization** (string) - Required - Example: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0aW1lb3V0IjoiMjAyMS0wNi0wMlQxODoyMTo1My44MTUxNzEzMSswODowMCIsInRpbWVzIjoiMjAyMS0wNS0yOFQxODoyMTo1My44MTUxNzA2MjErMDg6MDAiLCJ1aWQiOiIxNyJ9.FUZgfvoLvSoLmICSR1_N8vABh2skTWQDHLGabqdm41ELX7n8Wd9xvgayUNW_nyLoGd825ZFNzwR4faCf3Y_9Nw #### Request Body - **repoId** (string) - Optional - The ID of the repository. - **page** (number) - Optional - The page number for pagination. - **size** (number) - Optional - The number of items per page. - **sort** (string) - Optional - The field to sort by. - **field** (string) - Optional - The field to retrieve. - **types** (string) - Optional - The type of variables to filter. - **q** (string) - Optional - A query string for searching variables. ### Request Example ```json { "repoId": "your_repo_id", "page": 1, "size": 10, "sort": "name_asc", "field": "name,value", "types": "env", "q": "my_var" } ``` ### Response #### Success Response (200) - **code** (number) - Status code. - **msg** (string) - Message indicating the result of the operation. - **data** (null) - The response data, which can be null. #### Response Example ```json { "code": 200, "msg": "Success", "data": null } ``` ``` -------------------------------- ### POST /pipeline/version Source: https://github.com/gitee-go/server/blob/main/api.md Endpoint to manage pipeline versions within the Gitee Go Server. ```APIDOC ## POST /pipeline/version ### Description This endpoint allows for the submission of pipeline version information. ### Method POST ### Endpoint /pipeline/version ### Parameters #### Headers - **Content-Type** (string) - Required - application/json - **Authorization** (string) - Required - JWT token for authentication #### Request Body - **pipelineVersionId** (string) - Optional - The ID of the pipeline version. ``` -------------------------------- ### POST /api/pipeline/save Source: https://context7.com/gitee-go/server/llms.txt Creates or updates a pipeline YAML configuration file with automatic validation. ```APIDOC ## POST /api/pipeline/save ### Description Creates or updates a pipeline YAML configuration file. The system automatically validates the YAML syntax and DAG structure. ### Method POST ### Endpoint /api/pipeline/save ### Request Body - **repoId** (string) - Required - The repository ID. - **branch** (string) - Required - The target branch. - **fileName** (string) - Required - The name of the configuration file. - **content** (string) - Required - The YAML content of the pipeline. ``` -------------------------------- ### Download Build Log API Source: https://context7.com/gitee-go/server/llms.txt Provides endpoints to download the complete build log or a specific Job's log file. Requires a version ID or job ID. ```bash # 下载构建日志 curl -X GET "http://localhost:8090/api/pipeline/downLog/version001" \ -H "Authorization: Bearer " \ -o build.log ``` ```bash # 下载 Job 日志 curl -X GET "http://localhost:8090/api/pipeline/downJobLog/job001" \ -H "Authorization: Bearer " \ -o job.log ``` -------------------------------- ### POST /api/repo/getRepos Source: https://context7.com/gitee-go/server/llms.txt Retrieves a paginated list of repositories accessible by the user. ```APIDOC ## POST /api/repo/getRepos ### Description Lists repositories with support for pagination and search. ### Method POST ### Endpoint http://localhost:8090/api/repo/getRepos ### Request Body - **page** (integer) - Required - Page number - **size** (integer) - Required - Page size - **q** (string) - Optional - Search query ### Request Example { "page": 1, "size": 20, "q": "my-project" } ### Response #### Success Response (200) - **code** (integer) - Status code - **data** (object) - Repository list data #### Response Example { "code": 200, "data": { "total": 50, "page": 1, "size": 20, "data": [ { "id": "repo123", "openid": "gitee_repo_456", "name": "my-project", "owner": "username", "active": 1, "visible": 1 } ] } } ``` -------------------------------- ### POST /api/login/login Source: https://context7.com/gitee-go/server/llms.txt Authenticates a user and returns a JWT token valid for 5 days. ```APIDOC ## POST /api/login/login ### Description Authenticates a user and returns a JWT token for subsequent API calls. ### Method POST ### Endpoint http://localhost:8090/api/login/login ### Request Body - **name** (string) - Required - Username - **pass** (string) - Required - Password ### Request Example { "name": "admin", "pass": "password123" } ### Response #### Success Response (200) - **code** (integer) - Status code - **data** (object) - User and token information #### Response Example { "code": 200, "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "id": "1", "name": "admin", "nick": "管理员", "avatar": "https://example.com/avatar.png", "lastLoginTime": "2024-01-15 10:30:00" } } ``` -------------------------------- ### Project Directory Structure Source: https://github.com/gitee-go/server/blob/main/readme.md Overview of the project's source code organization. ```text comm : . ├── app.go ├── db.go 文件缓存操作包括set.clear等 ├── hook │ ├── action.go webhook中的action常量 │ ├── git.go 结构体定义,包含Reference,Commit,User │ ├── gitee │ │ ├── gitee.go │ │ └── hook_test.go │ ├── pr.go webhook的pull request结构体定义 │ ├── repo.go webhook的代码仓库定义 │ ├── webhook.go webhook的接口和一些结构体定义 │ └── zip_test.go ├── limit.go 同时解析yml数和构建数设置 ├── migrate.go 数据库升降级工具 ├── notice │ └── notice.go 通知结构体和内容定义 ├── plugin │ └── plugin.go 存放于DB中的插件的相关操作,从db获取plugin,解析plugin等 ├── repo │ └── repo.go 仓库的相关操作,仓库目录打包zip ├── thirdapi.go 获取第三方的api client,包括gitee,github,gitlab等 ├── uifls.go ui的base64 ├── workpath.go 包含工作路径的初始化和定义 ├── yml 流水线yml │ ├── dag │ │ └── dag.go 初始化dag,新增dag到db等操作 │ ├── disc.yaml │ ├── vars │ │ └── yml.go 流水线yml中的变量的相关操作,包含替换yml变量,替换流水线变量等 │ ├── veri.yaml │ ├── yml.go 流水线yml的接口定义 │ └── yml_test.go └── ymlconf.go server的application.yaml的结构定义和相关操作,包含初始化,检查等 engine: . ├── agent 暂时没有用到 │ ├── client.go │ └── clients.go ├── comm │ ├── group.go cmd命令组的结构体定义 │ ├── inter.go PreBuild和Build引擎的接口定义 │ ├── job.go 构建过程中的job结构体定义 │ └── plugin.go 限制plugin ├── dao │ └── update.go runtime更新build.step状态的相关操作 ├── local │ ├── buildengine.go Build引擎的实现 │ ├── buildtask.go job调度的实现 │ ├── buildtaskc.go job调度的效验 │ ├── clientengine.go 管理runner,包含注册,发现,获取runner信息等 │ ├── prebuild_test.go │ ├── prebuildengine.go PreBuild的实现 │ ├── refreshengine.go 调用api刷新代码仓库的引擎 │ └── taskbuild.go PreBuild的task实现 ├── mgr.go 引擎的管理,初始化,启动,停止等. └── mgrs.go route: 业务接口 . ├── api.go ├── apiManual.go ├── badge.go ├── hooks.go ├── login.go ├── namespace.go ├── notice.go ├── oauth.go ├── oauths.go ├── pipeline.go ├── plugin.go ├── pubs.go ├── repo.go └── system.go routehb: . ├── auth.go runner的请求鉴权 ├── client.go ├── runner.go server与runner之间的通信,包括日志,制品等的传输,runner获取job等 routes: 安装的路由和实现 . ├── install.go ├── install1.go └── install2.go server: . ├── command.go server的cli实现 ├── db.go 初始化数据库和文件缓存 ├── route.go 路由的注册 ├── server.go 服务启动 └── web.go service:业务相关的实现 . ├── api.go ├── api_test.go ├── hooks.go ├── mid.go ├── notice.go ├── param.go ├── perms.go ├── token.go └── user.go ``` -------------------------------- ### POST /login/getParam Source: https://github.com/gitee-go/server/blob/main/api.md Fetch parameters required for login processes. ```APIDOC ## POST /login/getParam ### Description Fetch parameters required for login processes. ### Method POST ### Endpoint /login/getParam ### Parameters #### Headers - **Content-Type** (string) - Required - application/x-www-form-urlencoded ```