用于更新拉取请求的构建状态的Bitbucket API

时间:2019-05-16 03:26:37

标签: bitbucket bitbucket-api bitbucket-cloud

我看到了用于更新提交的构建状态的文档: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses/build

对于拉取请求,是否没有与之关联的唯一提交?是否没有用于更新PR的构建状态的API?还是只需要发现与PR关联的提交,然后更新该提交的构建状态?

例如,此视图:

enter image description here

您可以在右侧看到temp分支的提交具有通过状态-但是它的工作方式是将 temp合并到master 中,并合并到一些新的commit / branch中,我需要可以进行测试。

我要更新的视图位于url:

https://bitbucket.org/<user>/<repo>/pull-requests/1/<commit-message>/diff

2 个答案:

答案 0 :(得分:0)

只需转到此URL并键入“ build”,您将找到相关的路线:

enter image description here

答案 1 :(得分:0)

Bitbucket没有基于PR的构建(检查here),您需要的是在 LAST 提交上完成的一个成功构建:

enter image description here

然后,您可以在完成测试所需的操作后使用API​​将构建推送到该构建。

该指南非常易于使用: https://developer.atlassian.com/server/bitbucket/how-tos/updating-build-status-for-commits/

?我对指南的唯一建议是,它不适用于curl,然后,我要做的就是用Postman进行操作,然后将命令导出到curl,就是这样... >

curl --location --request POST 'https://bitbucket.org/api/2.0/repositories/{your space}/{Your Repo}/commit/{The long hash of your commit}/statuses/build?Content-Type=application/json' \
--header 'Authorization: Basic {your token}=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "state": "SUCCESSFUL",
    "key": "MANUAL-BUILD",
    "name": "Manual Build",
    "url": "http://this.really.doesnt.matter/",
    "description": "Successful Build done manually"
}'
相关问题