Reputation: 100060
I see the docs for updating the build status for a commit: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses/build
For a pull request, isn't there a unique commit associated with it? Is there no API for updating a PR's build status? Or do we just need to discover which commit is associated with the PR, and then just update the build status for that commit?
For example this view:
You can see on the right that the commit to the temp branch has a passing build status - but the way it works is it should merge temp into master into some new commit/branch and I need to be able to test that.
The view that I want to update is at url:
https://bitbucket.org/<user>/<repo>/pull-requests/1/<commit-message>/diff
Upvotes: 2
Views: 5626
Reputation: 1327
Bitbucket does not have Builds on PRs (Check here), What you need is one Successful Build on the LAST Commit:
Then, you can use the API to push the build to that one after you have done what you need to test it.
This guide is really simple to use: https://developer.atlassian.com/server/bitbucket/how-tos/updating-build-status-for-commits/
👆The only recommendation I have on the guide is that it didn't work for me with curl, then, what I did was to do it with Postman and then exported the command to curl and that's it...
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"
}'
Upvotes: 4
Reputation: 100060
Just go to this this url and type "build" and you will find the relevant routes:
Upvotes: 0