2

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

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

例如这个视图:

enter image description here

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

我要更新的视图位于 url:

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

2 回答 2

3

Bitbucket 没有在 PR 上构建(在此处查看),您需要的是在LAST Commit 上成功构建:

在此处输入图像描述

然后,在完成所需的测试后,您可以使用 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"
}'
于 2020-06-01T21:55:30.990 回答
0

只需转到此 url 并输入“build”,您就会找到相关的路线:

enter image description here

于 2019-05-25T22:04:25.617 回答