-
Bug
-
Resolution: Fixed
-
Low
-
8.0.0, 8.19.6, 8.19.10
-
2
-
Severity 3 - Minor
-
3
-
Issue Summary
Using the below API to manually post the build status:
http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
without the PARENT parameter gives the warning on the Bitbucket UI "Successful build of testFolder for the latest commit is required before this pull request can be merged".
We need to update the REST API documentation to make this a required parameter.
Steps to Reproduce
- In the request body of the API
http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds'
don't include the parent parameter:
{ "key": "TEST-REP123", "state": "SUCCESSFUL", "url": "https://bamboo.url/browse/TEST-REP1-3", "buildNumber": "3", "description": "Unit test build", "duration": 1500000, "lastUpdated": 1359075920, "name": "Database Matrix Tests", "ref": "refs/heads/master", "testResults": { "failed": 1, "skipped": 8, "successful": 0 } }
- Manually try to run this API query to POST the build status.
Expected Results
The API should be able to add/update the Build status to Bitbucket
Actual Results
The warning "Successful build of testFolder for the latest commit is required before this pull request can be merged" can be seen on the Bitbucket UI.
For the Required builds feature to work, we look for the Parent parameter and check if it has successful builds attached to it
Workaround
The parent parameter is the one we check to determine if the build is successful or not, here's an example:
{ "key": "TEST-REP123", "state": "SUCCESSFUL", "url": "https://bamboo.url/browse/TEST-REP1-3", "buildNumber": "3", "description": "Unit test build", "duration": 1500000, "lastUpdated": 1359075920, "name": "Database Matrix Tests", "parent": "TEST-REP", "ref": "refs/heads/master", "testResults": { "failed": 1, "skipped": 8, "successful": 0 } }
Please make sure to include that in the request body for the POST query.
Relevant API links for example: