# Tag
如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)
# TAG 列表
返回项目版本库 tag 列表
GET /api/v3/projects/:id/repository/tags
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| search | String (可选) | 对 tagname 进行模糊搜索 |
| page | integer(可选) | 分页(default:1) |
| per_page | integer(可选) | 默认页面大小(default:20,max:100) |
| order_by | String(可选) | 返回列表的排序字段,可选字段:name、created_at(默认值,将按照 committed_date 字段排序) |
| sort | String(可选) | order_by 的排序顺序 ,可选可选字段:asc、desc(默认) |
返回值:
[
{
"name": "v1.0",
"message": "1.0 版本第一次上线版本",
"commit": {
"id": "6be50b7afaf98f49896b45ac6c19fb19315286cc",
"message": "Merge branch 'master'",
"parent_ids": [
"f888582ad6976daef5ba793d4663a60d5b031151",
"6ad05205ec9a4681d1ce17f38ba0a64729981db9"
],
"authored_date": "2016-10-23T23:10:19+0000",
"author_name": "userExample",
"author_email": "user_example@tencent.com",
"committed_date": "2016-10-23T23:10:19+0000",
"committer_name": "userExample",
"committer_email": "user_example@tencent.com",
"title": "Merge branch 'master'",
"created_at": "2016-10-23T23:10:19+0000",
"short_id": "6be50b7a"
}
"created_at": "2024-01-23T08:53:06+0000",
"description": "新增 tag"
},
{
"name": "v1.0.1",
"message": "1.0.0 版本 bugfixed",
"commit": {
"id": "7eee7c871a74f114bbc0df10c9bbacee870ae409",
"message": "fixed:测试环境 pageContext.request.localName 处理速度慢问题处理",
"parent_ids": [
"6b7fa77bf10d348195e1a79312471f8b3d1aef4a"
],
"authored_date": "2016-11-21T03:19:38+0000",
"author_name": "userExample",
"author_email": "user_example@tencent.com",
"committed_date": "2016-11-21T03:19:38+0000",
"committer_name": "userExample",
"committer_email": "user_example@tencent.com",
"title": "fixed:测试环境 pageContext.request.localName 处理速度慢问题处理",
"created_at": "2016-11-21T03:19:38+0000",
"short_id": "7eee7c87"
}
"created_at": "2024-01-24T08:53:06+0000",
"description": "新增 tag"
}
]
# 获取指定 TAG
返回项目版本库某个 tag 详情
GET /api/v3/projects/:id/repository/tags/:tag
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| tag | string | tag 名 |
返回值:
{
"name": "v1.0",
"message": "1.0 版本第一次上线版本",
"commit": {
"id": "6be50b7afaf98f49896b45ac6c19fb19315286cc",
"message": "Merge branch 'master'",
"parent_ids": [
"f888582ad6976daef5ba793d4663a60d5b031151",
"6ad05205ec9a4681d1ce17f38ba0a64729981db9"
],
"authored_date": "2016-10-23T23:10:19+0000",
"author_name": "userExample",
"author_email": "user_example@tencent.com",
"committed_date": "2016-10-23T23:10:19+0000",
"committer_name": "userExample",
"committer_email": "user_example@tencent.com",
"title": "Merge branch 'master'",
"created_at": "2016-10-23T23:10:19+0000",
"short_id": "6be50b7a"
}
"created_at": "2024-01-23T08:53:06+0000",
"description": "新增 tag"
}
# 创建 TAG
创建项目版本库 tag
POST /api/v3/projects/:id/repository/tags
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| tag_name | string | tag 名 |
| ref | string | ref可以是SHA, branch name, tag name |
| message | string(可选) | tag的附注 |
| description | string(可选) | tag描述 |
返回值:
{
"name": "ccccccccccc",
"message": "message",
"commit": {
"id": "d21f748b73507a227a92c954bd3c89bf4e78e897",
"message": "Merge branch 'b1' into 'master'\r\n\r\nxxx\r\n\r\nxxx\r\n\r\nSee merge request !78",
"parent_ids": [
"78a1d588ce01b0e6aec46c7cc5aa407d6e7cfd24",
"75029d005ac29572f04c461ab3257714245c9798"
],
"authored_date": "2017-06-07T07:38:33+0000",
"author_name": "userExample",
"author_email": "user_example@tencent.com",
"committed_date": "2017-06-07T07:38:33+0000",
"committer_name": "userExample",
"committer_email": "user_example@tencent.com",
"title": "Merge branch 'b1' into 'master'",
"created_at": "2017-06-07T07:38:33+0000",
"short_id": "d21f748b"
}
}
# 删除 TAG
删除项目版本库 tag,需要有项目的 admin 权限
DELETE /api/v3/projects/:id/repository/tags/:tag
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| tag | string | tag 名 |
返回值:
{
"tag_name": "my-removed-tag"
}
# 获取 TAG 设置
查询允许的 tag 名称的 regex 表达式,以及允许推送的用户应该具有的权限级别设置,接口调用需要项目的 master 以上权限
GET /api/v3/projects/:id/repository/tag_settings
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
返回值:
{
"tag_name_regex": "301",
"tag_create_push_level": 30
}
# 设置 TAG
设置项目版本库 tag 允许的 tag 名称、允许的推送,接口调用需要有项目的 master 以上权限
PUT /api/v3/projects/:id/repository/tag_settings
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径 project_full_path |
| tag_name_regex | string(可选) | 允许的 tag 名称的 regex 表达式 |
| tag_create_push_level | integer(可选) | 允许推送的用户应该具有的权限级别,有效值:0,30,40。 0 :Group Owner only; 30:Project Developer or above; 40:Project Master or Group Owner |
返回值:
{
"tag_name_regex": "301",
"tag_create_push_level": 30
}
← 保护分支规则组 Releases 相关 →