Files
bigscreen/PLANE_API_NOTES.md
bruno b41a2d6a3f
Build & Push - 构建并推送镜像 / 构建后端镜像 (push) Failing after 1s
Build & Push - 构建并推送镜像 / 构建前端镜像 (push) Failing after 1s
Build & Push - 构建并推送镜像 / 构建通知 (push) Failing after 1s
CI - 代码检查和测试 / Python 代码检查 (push) Failing after 1s
CI - 代码检查和测试 / Python 单元测试 (push) Failing after 1s
CI - 代码检查和测试 / Frontend 代码检查 (push) Failing after 1s
CI - 代码检查和测试 / Frontend 构建测试 (push) Failing after 1s
Plane Integration - 项目管理集成 / 同步到 Plane (push) Failing after 1s
feat: 集成 Plane 项目管理系统
✨ 新功能:
- 添加 Plane CI/CD 集成 workflow
- 自动创建构建记录 Issue
- 同步 CI/CD 状态到 Plane
- 生成详细构建报告

🔧 配置更新:
- 更新 Registry 地址: 192.168.1.83:15000
- 更新 Registry 缓存: 192.168.1.83:15001
- 更新项目名称: bigscreen
- 修正 Plane API header 格式 (X-API-Key)
- 修正项目标识符: BIGSCREEN

📚 新增文档:
- PLANE_INTEGRATION.md - Plane 集成详细指南
- DEVOPS_INTEGRATION.md - 完整 DevOps 方案
- QUICKSTART_DEVOPS.md - 5分钟快速上手指南
- PLANE_API_NOTES.md - API 使用说明和常见问题
- TEST_INTEGRATION.md - 集成测试指南

🧪 已测试:
- Plane API 调用成功
- Issue 创建成功
- 完整工作流验证通过
2025-12-07 22:35:24 +08:00

3.0 KiB
Raw Permalink Blame History

Plane API 使用说明

✅ 正确的 API 调用方式

1. Header 格式

正确 ✅:

curl "http://192.168.1.83:8088/api/v1/users/me/" \
  -H "X-API-Key: plane_api_xxxxx..."

注意: Header 名称是 X-API-Key(注意大小写)

2. 获取项目信息

Plane API 不支持通过 identifier 直接获取单个项目,需要:

  1. 先获取项目列表
  2. 从列表中查找匹配的项目
# 获取所有项目
curl "http://192.168.1.83:8088/api/v1/workspaces/ljwx/projects/" \
  -H "X-API-Key: plane_api_xxxxx..."

# 返回结果中查找 identifier = "BIGSCREEN" 的项目
# 然后使用项目的 UUID 进行后续操作

3. 创建 Issue

curl -X POST "http://192.168.1.83:8088/api/v1/workspaces/ljwx/projects/PROJECT_UUID/issues/" \
  -H "X-API-Key: plane_api_xxxxx..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Issue 标题",
    "description_html": "<p>Issue 描述</p>",
    "priority": "medium"
  }'

注意事项:

  • priority 可选值: urgent, high, medium, low, none
  • labels 需要使用标签的 UUID 数组,不能使用字符串
  • state 需要使用状态的 UUID

4. 项目标识符

对于 bigscreen 项目:

  • 项目名称: BigScreen 大屏系统
  • Identifier: BIGSCREEN (大写)
  • UUID: b0256fc8-65c0-4c02-80e0-8ca2c077a3b4
  • Workspace: ljwx

🔧 实际测试结果

✅ 成功创建的 Issue

Issue 标题: 🏗️ 构建 main - 4055696
Issue ID: fbadc6bd-075a-4f3f-8026-698316eac665
访问链接: http://192.168.1.83:8088/ljwx/projects/BIGSCREEN/issues/fbadc6bd-075a-4f3f-8026-698316eac665

📋 常用 API 端点

端点 方法 说明
/api/v1/users/me/ GET 获取当前用户信息
/api/v1/workspaces/ GET 获取所有 workspace
/api/v1/workspaces/{slug}/projects/ GET 获取 workspace 下的项目列表
/api/v1/workspaces/{slug}/projects/{uuid}/ GET 获取单个项目信息(需要 UUID)
/api/v1/workspaces/{slug}/projects/{uuid}/issues/ GET/POST 获取/创建 Issue
/api/v1/workspaces/{slug}/projects/{uuid}/issues/{issue_id}/comments/ POST 添加评论

🐛 常见问题

Q: 为什么通过 identifier 获取项目返回 404?

A: Plane API 不支持直接通过 identifier 获取项目,必须:

  1. 先获取项目列表
  2. 遍历查找匹配的 identifier
  3. 使用找到的项目 UUID

Q: 创建 Issue 时 labels 报错?

A: labels 参数需要 UUID 数组,不能使用字符串:

// ❌ 错误
{
  "labels": ["ci-cd", "build"]
}

// ✅ 正确(需要先获取标签的 UUID)
{
  "labels": ["uuid1", "uuid2"]
}

Q: API Key 格式是什么?

A: plane_api_ 开头的字符串,例如:

plane_api_d500d9ead4d14a0aa28ef20c15aca11e

🔗 相关链接