给指定的Commit添加一条提交状态记录。
接口说明
根据 Commit SHA 和 Context 作为组合条件,限制单库的提交状态记录不超过 1000 条,否则会报错。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
POST /api/v4/projects/repository/commit_statuses/create_commit_status HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| organizationId |
string |
是 |
企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】 |
5ebbc0228123212b59xxxxx |
| accessToken |
string |
否 |
个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段 |
f0b1e61db5961df5975a93f9129d2513 |
| repositoryIdentity |
string |
是 |
代码库 ID 或者全路径 |
2080972 |
| sha |
string |
是 |
仅支持提交 ID,即 Commit SHA |
e0c1a1299a2656bfc155650bbd2df5e628fa1f4c |
| body |
object |
否 |
请求 Body |
|
| state |
string |
是 |
写入状态,且仅能填入以下四个字符串,否则会返回错误。
|
success |
| description |
string |
否 |
提交状态的简要描述,且不能超过 3000 个字符 |
提交状态描述内容 |
| targetUrl |
string |
否 |
用户自行写入的跳转链接,代码平台仅提供跳转的 UI,一般可设置为三方系统的链接 |
https://example.com/builds/1001 |
| context |
string |
否 |
用于区分不同系统写入的字符串标识,会以标题的作用在相应的页面 UI 处进行展示,默认为 default,长度不超过 50,且英文大小写不敏感 说明
该参数在设置卡点和合并请求联动中非常重要,若非测试调试,切勿随意设置。 |
default |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| requestId |
string |
请求 ID |
020F71F3-F063-5B8B-8978-2B01833216BB |
| success |
boolean |
调用是否成功 |
true |
| errorCode |
string |
错误码 |
SYSTEM_UNKNOWN_ERROR |
| errorMessage |
string |
错误信息 |
"" |
| result |
object |
返回结果 |
|
| id |
integer |
ID(无业务实际意义) |
30815 |
| sha |
string |
提交 ID,即 Commit SHA |
c0ca103441b9fa7f369be8d24a6f20db44dfddf7 |
| context |
string |
用于区分不同系统写入的字符串标识,会以标题的作用在相应的页面 UI 处进行展示,默认为 default,长度不超过 50,且英文大小写不敏感 |
default |
| state |
string |
写入状态
|
success |
| targetUrl |
string |
用户自行写入的跳转链接,代码平台仅提供跳转的 UI,一般可设置为三方系统的链接 |
https://example.com/builds/1001 |
| description |
string |
提交状态的简要描述,且不能超过 3000 个字符 |
提交状态描述内容 |
| creator |
object |
提交状态的写入人简要信息 |
|
| aliyunPk |
integer |
阿里云账号 ID,若 type=Bot 时,则为空 |
204485087002425236 |
| login |
string |
若 type=User,则为用户名;若 type=Bot,则为应用名 |
codeup |
| avatarUrl |
string |
头像地址 |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
| type |
string |
写入人类型
|
User |
示例
正常返回示例
JSON格式
{
"requestId": "020F71F3-F063-5B8B-8978-2B01833216BB",
"success": true,
"errorCode": "SYSTEM_UNKNOWN_ERROR",
"errorMessage": "\"\"",
"result": {
"id": 30815,
"sha": "c0ca103441b9fa7f369be8d24a6f20db44dfddf7",
"context": "default",
"state": "success",
"targetUrl": "https://example.com/builds/1001",
"description": "提交状态描述内容",
"creator": {
"aliyunPk": 204485087002425250,
"login": "codeup",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
"type": "User"
}
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。